Skip to content

Commit 28b1227

Browse files
authored
Merge pull request #233849 from eric-urban/eur/speech-containers
Speech containers refresh
2 parents 78d748c + de3606c commit 28b1227

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1511
-982
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
author: eric-urban
3+
manager: nitinme
4+
ms.service: cognitive-services
5+
ms.subservice: speech-service
6+
ms.topic: include
7+
ms.date: 04/18/2023
8+
ms.author: eur
9+
---
10+
11+
The following table represents the various `docker run` parameters and their corresponding descriptions:
12+
13+
| Parameter | Description |
14+
|---------|---------|
15+
| `{VOLUME_MOUNT}` | The host computer [volume mount](https://docs.docker.com/storage/volumes/), which Docker uses to persist the custom model. An example is `c:\CustomSpeech` where the `c:\` drive is located on the host machine. |
16+
| `{MODEL_ID}` | The custom speech or base model ID. For more information, see [Get the model ID](#get-the-model-id). |
17+
| `{ENDPOINT_URI}` | The endpoint is required for metering and billing. For more information, see [billing arguments](../speech-container-howto.md#billing-arguments). |
18+
| `{API_KEY}` | The API key is required. For more information, see [billing arguments](../speech-container-howto.md#billing-arguments). |
19+
20+
When you run the custom speech-to-text container, configure the port, memory, and CPU according to the custom speech-to-text container [requirements and recommendations](../speech-container-howto.md#container-requirements-and-recommendations).
21+
22+
Here's an example `docker run` command with placeholder values. You must specify the `VOLUME_MOUNT`, `MODEL_ID`, `ENDPOINT_URI`, and `API_KEY` values:
23+
24+
```bash
25+
docker run --rm -it -p 5000:5000 --memory 8g --cpus 4 \
26+
-v {VOLUME_MOUNT}:/usr/local/models \
27+
mcr.microsoft.com/azure-cognitive-services/speechservices/custom-speech-to-text \
28+
ModelId={MODEL_ID} \
29+
Eula=accept \
30+
Billing={ENDPOINT_URI} \
31+
ApiKey={API_KEY}
32+
```
33+
34+
This command:
35+
36+
* Runs a custom speech-to-text container from the container image.
37+
* Allocates 4 CPU cores and 8 GB of memory.
38+
* Loads the custom speech-to-text model from the volume input mount, for example, *C:\CustomSpeech*.
39+
* Exposes TCP port 5000 and allocates a pseudo-TTY for the container.
40+
* Downloads the model given the `ModelId` (if not found on the volume mount).
41+
* If the custom model was previously downloaded, the `ModelId` is ignored.
42+
* Automatically removes the container after it exits. The container image is still available on the host computer.
43+
44+
For more information about `docker run` with Speech containers, see [Install and run Speech containers with Docker](../speech-container-howto.md#run-the-container).
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
author: eric-urban
3+
manager: nitinme
4+
ms.service: cognitive-services
5+
ms.subservice: speech-service
6+
ms.topic: include
7+
ms.date: 04/18/2023
8+
ms.author: eur
9+
---
10+
11+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method.
12+
13+
> [!IMPORTANT]
14+
> When you use the Speech service with containers, be sure to use [host authentication](../speech-container-howto.md#host-urls). If you configure the key and region, requests will go to the public Speech service. Results from the Speech service might not be what you expect. Requests from disconnected containers will fail.
15+
16+
::: zone pivot="programming-language-csharp"
17+
Instead of using this Azure-cloud initialization config:
18+
19+
```csharp
20+
var config = SpeechConfig.FromSubscription(...);
21+
```
22+
23+
Use this config with the container [host](/dotnet/api/microsoft.cognitiveservices.speech.speechconfig.fromhost):
24+
25+
```csharp
26+
var config = SpeechConfig.FromHost(
27+
new Uri("http://localhost:5000"));
28+
```
29+
::: zone-end
30+
31+
::: zone pivot="programming-language-cpp"
32+
Instead of using this Azure-cloud initialization config:
33+
34+
```cpp
35+
auto speechConfig = SpeechConfig::FromSubscription(...);
36+
```
37+
38+
Use this config with the container [host](/cpp/cognitive-services/speech/speechconfig#fromhost):
39+
40+
```cpp
41+
auto speechConfig = SpeechConfig::FromHost("http://localhost:5000");
42+
```
43+
::: zone-end
44+
45+
::: zone pivot="programming-language-go"
46+
Instead of using this Azure-cloud initialization config:
47+
48+
```go
49+
speechConfig, err := speech.NewSpeechConfigFromSubscription(...)
50+
```
51+
52+
Use this config with the container host:
53+
54+
```go
55+
speechConfig, err := speech.NewSpeechConfigFromHost("http://localhost:5000")
56+
```
57+
::: zone-end
58+
59+
::: zone pivot="programming-language-java"
60+
Instead of using this Azure-cloud initialization config:
61+
62+
```java
63+
SpeechConfig speechConfig = SpeechConfig.fromSubscription(...);
64+
```
65+
66+
Use this config with the container [host](/java/api/com.microsoft.cognitiveservices.speech.speechconfig#com-microsoft-cognitiveservices-speech-speechconfig-fromhost(java-net-uri)):
67+
68+
```java
69+
SpeechConfig speechConfig = SpeechConfig.fromHost("http://localhost:5000");
70+
```
71+
::: zone-end
72+
73+
::: zone pivot="programming-language-javascript"
74+
Instead of using this Azure-cloud initialization config:
75+
76+
```javascript
77+
const speechConfig = sdk.SpeechConfig.fromSubscription(...);
78+
```
79+
80+
Use this config with the container [host](/javascript/api/microsoft-cognitiveservices-speech-sdk/speechconfig#microsoft-cognitiveservices-speech-sdk-speechconfig-fromhost):
81+
82+
```javascript
83+
const speechConfig = sdk.SpeechConfig.fromHost("http://localhost:5000");
84+
```
85+
::: zone-end
86+
87+
::: zone pivot="programming-language-objectivec"
88+
Instead of using this Azure-cloud initialization config:
89+
90+
```objectivec
91+
SPXSpeechConfiguration *speechConfig = [[SPXSpeechConfiguration alloc] initWithSubscription:...];
92+
```
93+
94+
Use this config with the container [host](/objectivec/cognitive-services/speech/spxspeechconfiguration#initwithhost):
95+
96+
```objectivec
97+
SPXSpeechConfiguration *speechConfig = [[SPXSpeechConfiguration alloc] initWithHost:"http://localhost:5000"];
98+
```
99+
::: zone-end
100+
101+
::: zone pivot="programming-language-swift"
102+
Instead of using this Azure-cloud initialization config:
103+
104+
```swift
105+
let speechConfig = SPXSpeechConfiguration(subscription: "", region: "");
106+
```
107+
108+
Use this config with the container [host](/objectivec/cognitive-services/speech/spxspeechconfiguration#initwithhost):
109+
110+
```swift
111+
let speechConfig = SPXSpeechConfiguration(host: "http://localhost:5000");
112+
```
113+
::: zone-end
114+
115+
::: zone pivot="programming-language-python"
116+
Instead of using this Azure-cloud initialization config:
117+
118+
```python
119+
speech_config = speechsdk.SpeechConfig(
120+
subscription=speech_key, region=service_region)
121+
```
122+
123+
Use this config with the container [endpoint](/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.speechconfig):
124+
125+
```python
126+
speech_config = speechsdk.SpeechConfig(
127+
host="http://localhost:5000")
128+
```
129+
::: zone-end
130+
131+
::: zone pivot="programming-language-cli"
132+
For information about how to configure the Speech CLI, see [Get started with the Azure Speech CLI](../spx-basics.md?tabs=dockerinstall#download-and-install).
133+
::: zone-end
134+
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
author: eric-urban
3+
manager: nitinme
4+
ms.service: cognitive-services
5+
ms.subservice: speech-service
6+
ms.topic: include
7+
ms.date: 04/18/2023
8+
ms.author: eur
9+
---
10+
11+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method.
12+
13+
> [!IMPORTANT]
14+
> When you use the Speech service with containers, be sure to use [host authentication](../speech-container-howto.md#host-urls). If you configure the key and region, requests will go to the public Speech service. Results from the Speech service might not be what you expect. Requests from disconnected containers will fail.
15+
16+
::: zone pivot="programming-language-csharp"
17+
Instead of using this Azure-cloud initialization config:
18+
19+
```csharp
20+
var config = SpeechConfig.FromSubscription(...);
21+
```
22+
23+
Use this config with the container [host](/dotnet/api/microsoft.cognitiveservices.speech.speechconfig.fromhost):
24+
25+
```csharp
26+
var config = SpeechConfig.FromHost(
27+
new Uri("ws://localhost:5000"));
28+
```
29+
::: zone-end
30+
31+
::: zone pivot="programming-language-cpp"
32+
Instead of using this Azure-cloud initialization config:
33+
34+
```cpp
35+
auto speechConfig = SpeechConfig::FromSubscription(...);
36+
```
37+
38+
Use this config with the container [host](/cpp/cognitive-services/speech/speechconfig#fromhost):
39+
40+
```cpp
41+
auto speechConfig = SpeechConfig::FromHost("ws://localhost:5000");
42+
```
43+
::: zone-end
44+
45+
::: zone pivot="programming-language-go"
46+
Instead of using this Azure-cloud initialization config:
47+
48+
```go
49+
speechConfig, err := speech.NewSpeechConfigFromSubscription(...)
50+
```
51+
52+
Use this config with the container host:
53+
54+
```go
55+
speechConfig, err := speech.NewSpeechConfigFromHost("ws://localhost:5000")
56+
```
57+
::: zone-end
58+
59+
::: zone pivot="programming-language-java"
60+
Instead of using this Azure-cloud initialization config:
61+
62+
```java
63+
SpeechConfig speechConfig = SpeechConfig.fromSubscription(...);
64+
```
65+
66+
Use this config with the container [host](/java/api/com.microsoft.cognitiveservices.speech.speechconfig#com-microsoft-cognitiveservices-speech-speechconfig-fromhost(java-net-uri)):
67+
68+
```java
69+
SpeechConfig speechConfig = SpeechConfig.fromHost("ws://localhost:5000");
70+
```
71+
::: zone-end
72+
73+
::: zone pivot="programming-language-javascript"
74+
Instead of using this Azure-cloud initialization config:
75+
76+
```javascript
77+
const speechConfig = sdk.SpeechConfig.fromSubscription(...);
78+
```
79+
80+
Use this config with the container [host](/javascript/api/microsoft-cognitiveservices-speech-sdk/speechconfig#microsoft-cognitiveservices-speech-sdk-speechconfig-fromhost):
81+
82+
```javascript
83+
const speechConfig = sdk.SpeechConfig.fromHost("ws://localhost:5000");
84+
```
85+
::: zone-end
86+
87+
::: zone pivot="programming-language-objectivec"
88+
Instead of using this Azure-cloud initialization config:
89+
90+
```objectivec
91+
SPXSpeechConfiguration *speechConfig = [[SPXSpeechConfiguration alloc] initWithSubscription:...];
92+
```
93+
94+
Use this config with the container [host](/objectivec/cognitive-services/speech/spxspeechconfiguration#initwithhost):
95+
96+
```objectivec
97+
SPXSpeechConfiguration *speechConfig = [[SPXSpeechConfiguration alloc] initWithHost:"ws://localhost:5000"];
98+
```
99+
::: zone-end
100+
101+
::: zone pivot="programming-language-swift"
102+
Instead of using this Azure-cloud initialization config:
103+
104+
```swift
105+
let speechConfig = SPXSpeechConfiguration(subscription: "", region: "");
106+
```
107+
108+
Use this config with the container [host](/objectivec/cognitive-services/speech/spxspeechconfiguration#initwithhost):
109+
110+
```swift
111+
let speechConfig = SPXSpeechConfiguration(host: "ws://localhost:5000");
112+
```
113+
::: zone-end
114+
115+
::: zone pivot="programming-language-python"
116+
Instead of using this Azure-cloud initialization config:
117+
118+
```python
119+
speech_config = speechsdk.SpeechConfig(
120+
subscription=speech_key, region=service_region)
121+
```
122+
123+
Use this config with the container [endpoint](/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.speechconfig):
124+
125+
```python
126+
speech_config = speechsdk.SpeechConfig(
127+
host="ws://localhost:5000")
128+
```
129+
::: zone-end
130+
131+
::: zone pivot="programming-language-cli"
132+
For information about how to configure the Speech CLI, see [Get started with the Azure Speech CLI](../spx-basics.md?tabs=dockerinstall#download-and-install).
133+
::: zone-end
134+

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/cli.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@ spx recognize --file whatstheweatherlike.wav
3737
> The Speech CLI defaults to English. You can choose a different language [from the speech-to-text table](../../../../language-support.md?tabs=stt). For example, add `--source de-DE` to recognize German speech.
3838
3939
The Speech CLI shows a text transcription of the speech on the screen.
40+
41+
## Run and use a container
42+
43+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
44+
45+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
46+

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/cpp.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,11 @@ With [Custom Speech](../../../custom-speech-overview.md), you can upload your ow
207207
auto speechConfig = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
208208
speechConfig->SetEndpointId("YourEndpointId");
209209
auto speechRecognizer = SpeechRecognizer::FromConfig(speechConfig);
210-
```
210+
```
211+
212+
## Run and use a container
213+
214+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
215+
216+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
217+

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/csharp.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ speechConfig.EndpointId = "YourEndpointId";
284284
var speechRecognizer = new SpeechRecognizer(speechConfig);
285285
```
286286

287+
## Run and use a container
288+
289+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
290+
291+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
292+
287293
## Change how silence is handled
288294

289295
If a user is expected to speak faster or slower than usual, the default behaviors for non-speech silence in input audio may not result in what you expect. Common problems with silence handling include:

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/go.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,10 @@ go run quickstart
180180
```
181181

182182
For detailed information, see the [reference content for the `SpeechConfig` class](https://pkg.go.dev/github.com/Microsoft/[email protected]/speech#SpeechConfig) and the [reference content for the `SpeechRecognizer` class](https://pkg.go.dev/github.com/Microsoft/[email protected]/speech#SpeechRecognizer).
183+
184+
## Run and use a container
185+
186+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
187+
188+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
189+

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/java.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,10 @@ SpeechConfig speechConfig = SpeechConfig.FromSubscription("YourSubscriptionKey",
226226
speechConfig.setEndpointId("YourEndpointId");
227227
SpeechRecognizer speechRecognizer = new SpeechRecognizer(speechConfig);
228228
```
229+
230+
## Run and use a container
231+
232+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
233+
234+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
235+

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/javascript.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,10 @@ var speechConfig = SpeechSDK.SpeechConfig.fromSubscription("YourSubscriptionKey"
206206
speechConfig.endpointId = "YourEndpointId";
207207
var speechRecognizer = new SpeechSDK.SpeechRecognizer(speechConfig);
208208
```
209+
210+
## Run and use a container
211+
212+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
213+
214+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
215+

articles/cognitive-services/Speech-Service/includes/how-to/recognize-speech/objectivec.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,10 @@ SPXSpeechConfiguration *speechConfig = [[SPXSpeechConfiguration alloc] initWithS
2929
speechConfig.endpointId = "YourEndpointId";
3030
SPXSpeechRecognizer* speechRecognizer = [[SPXSpeechRecognizer alloc] init:speechConfig];
3131
```
32+
33+
## Run and use a container
34+
35+
Speech containers provide websocket-based query endpoint APIs that are accessed through the Speech SDK and Speech CLI. By default, the Speech SDK and Speech CLI use the public Speech service. To use the container, you need to change the initialization method. Use a container host URL instead of key and region.
36+
37+
For more information about containers, see the [speech containers](../../../speech-container-howto.md#host-urls) how-to guide.
38+

0 commit comments

Comments
 (0)