この記事では、Custom Speech モデルのエンドポイントをデプロイする方法について学習します。 バッチ文字起こしを除き、Custom Speech モデルを使用するには、カスタム エンドポイントをデプロイする必要があります。
ヒント
バッチ文字起こし API で Custom Speech を使用するには、ホストされたデプロイ エンドポイントは必要ありません。 Custom Speech モデルがバッチ文字起こしにのみ使用される場合は、リソースを節約できます。 詳細については、「Speech Services の価格」を参照してください。
基本モデルまたはカスタム モデルのエンドポイントをデプロイし、後でエンドポイントを 更新 して、より適切なトレーニング済みモデルを使用できます。
注意
F0 Speech リソースによって使用されるエンドポイントは、7 日後に削除されます。
デプロイメント エンドポイントの追加
ヒント
Speech Studio から Azure AI Foundry ポータルにカスタム音声モデルを取り込みます。 Azure AI Foundry ポータルでは、既存の Speech リソースに接続することで、中断した場所を選択できます。 既存の Speech リソースへの接続の詳細については、既存の Speech リソースへの接続に関する記事を参照してください。
Azure AI Foundry ポータルにサインインします。
左側のウィンドウから [微調整 ] を選択し、[ AI サービスの微調整] を選択します。
カスタム音声の微調整 の開始方法に関する記事の説明に従って、開始したカスタム音声微調整タスク (モデル名別) を選択します。
モデルをデプロイする>+ モデルをデプロイする を選択します。
新しいモデルのデプロイ ウィザードで、デプロイするモデルを選択します。
デプロイの名前と説明を入力します。 使用条件に同意するボックスを選択します。 配置 を選択します。
デプロイの状態が [成功] になったら、デプロイの詳細を表示できます。 デプロイを選択して、エンドポイント ID などの詳細を表示します。
カスタム エンドポイントを作成するには、これらの手順に従います。
Speech Studio にサインインします。
[Custom Speech]> プロジェクト名 >[モデルのデプロイ] を選択します。
これが最初のエンドポイントの場合、テーブルにはエンドポイントが表示されていません。 エンドポイントを作成したら、このページを使用して、デプロイされた各エンドポイントを追跡します。
[モデルのデプロイ] を選択して、新しいエンドポイント ウィザードを開始します。
[新しいエンドポイント] ページで、カスタム エンドポイントの名前と説明を入力します。
エンドポイントに関連付けるカスタム モデルを選択します。
必要に応じてチェック ボックスをオンにして、エンドポイントのトラフィックの音声ログと診断 ログ を有効にすることができます。
[追加] を選択して、エンドポイントを保存してデプロイします。
メインの [モデルのデプロイ] ページで、新しいエンドポイントの詳細 (名前、説明、状態、有効期限など) がテーブルに表示されます。 カスタム モデルを使用する新しいエンドポイントをインスタンス化するには、最大で 30 分かかることがあります。 デプロイの状態が [成功] に変わると、エンドポイントは使用できる状態です。
重要
モデルの有効期限の日付をメモします。 これは、音声認識にカスタム モデルを使用できる最後の日付です。 詳細については、「モデルとエンドポイントのライフサイクル」を参照してください。
エンドポイント リンクを選択すると、エンドポイント キー、エンドポイントの URL、サンプル コードなど、そのエンドポイントに固有の情報が表示されます。
続行する前に、 Speech CLI がインストールされ、構成されていることを確認します。
エンドポイントを作成してモデルをデプロイするには、spx csr endpoint create コマンドを使用します。 次の手順に従って要求パラメーターを作成します。
-
projectプロパティを既存のプロジェクトの ID に設定します。projectでカスタム音声の微調整を管理できるように、 プロパティをお勧めします。 プロジェクト ID を取得するには、 REST API ドキュメントのプロジェクト ID を取得するを 参照してください。 - 必要な
modelプロパティを、エンドポイントにデプロイするモデルの ID に設定します。 - 必須の
languageプロパティを設定します。 エンドポイント ロケールは、モデルのロケールと一致する必要があります。 ロケールを後から変更することはできません。 Speech CLIlanguageプロパティは、JSON 要求と応答のlocaleプロパティに対応します。 - 必須の
nameプロパティを設定します。 これは、 Azure AI Foundry ポータルに表示される名前です。 Speech CLInameプロパティは、JSON 要求と応答のdisplayNameプロパティに対応します。 - 必要に応じて、
loggingプロパティを設定できます。 エンドポイントのトラフィックの音声ログと診断enabledを有効にするには、これを に設定します。 既定値は、falseです。
エンドポイントを作成してモデルをデプロイする Speech CLI コマンドの例を次に示します。
spx csr endpoint create --api-version v3.2 --project YourProjectId --model YourModelId --name "My Endpoint" --description "My Endpoint Description" --language "en-US"
重要
--api-version v3.2を設定する必要があります。 Speech CLI では REST API が使用されますが、 v3.2以降のバージョンはまだサポートされていません。
次の形式で応答本文を受け取る必要があります。
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/aaaabbbb-0000-cccc-1111-dddd2222eeee",
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/bbbbcccc-1111-dddd-2222-eeee3333ffff"
},
"links": {
"logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/a07164e8-22d1-4eb7-aa31-bf6bb1097f37/files/logs",
"restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/ccccdddd-2222-eeee-3333-ffff4444aaaa"
},
"properties": {
"loggingEnabled": true
},
"lastActionDateTime": "2024-07-15T16:29:36Z",
"status": "NotStarted",
"createdDateTime": "2024-07-15T16:29:36Z",
"locale": "en-US",
"displayName": "My Endpoint",
"description": "My Endpoint Description"
}
応答本文の最上位の self プロパティはエンドポイントの URI です。 この URI を使用して、エンドポイントのプロジェクト、モデル、ログに関する詳細を取得します。 また、この URI を使用してエンドポイントを更新します。
エンドポイントに関する Speech CLI ヘルプを表示するには、次のコマンドを実行します。
spx help csr endpoint
エンドポイントを作成してモデルをデプロイするには、Speech to text REST API の Endpoints_Create 操作を使用します。 次の手順に従って要求本文を作成します。
-
projectプロパティを既存のプロジェクトの URI に設定します。 このプロパティは、 Azure AI Foundry ポータルでエンドポイントを表示および管理できるように推奨されます。 プロジェクト ID を取得するには、 REST API ドキュメントのプロジェクト ID を取得するを 参照してください。 - 必須の
modelプロパティをエンドポイントにデプロイするモデルの ID に設定します。 - 必須の
localeプロパティを設定します。 エンドポイント ロケールは、モデルのロケールと一致する必要があります。 ロケールを後から変更することはできません。 - 必須の
displayNameプロパティを設定します。 これは、 Azure AI Foundry ポータルに表示される名前です。 - 必要に応じて、
loggingEnabledのpropertiesプロパティを設定できます。 エンドポイントのトラフィックの音声ログと診断trueを有効にするには、これを に設定します。 既定値は、falseです。
HTTP POST 要求は、以下の Endpoints_Create の例に示したように URI を使用して行います。
YourSpeechResoureKey は実際の Speech リソース キーに、YourServiceRegion は実際の Speech リソース リージョンに置き換えたうえで、前述のように要求本文のプロパティを設定してください。
curl -v -X POST -H "Ocp-Apim-Subscription-Key: YourSpeechResoureKey" -H "Content-Type: application/json" -d '{
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/ccccdddd-2222-eeee-3333-ffff4444aaaa"
},
"properties": {
"loggingEnabled": true
},
"displayName": "My Endpoint",
"description": "My Endpoint Description",
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/ddddeeee-3333-ffff-4444-aaaa5555bbbb"
},
"locale": "en-US",
}' "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints"
次の形式で応答本文を受け取る必要があります。
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/aaaabbbb-0000-cccc-1111-dddd2222eeee",
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/bbbbcccc-1111-dddd-2222-eeee3333ffff"
},
"links": {
"logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/a07164e8-22d1-4eb7-aa31-bf6bb1097f37/files/logs",
"restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/ccccdddd-2222-eeee-3333-ffff4444aaaa"
},
"properties": {
"loggingEnabled": true
},
"lastActionDateTime": "2024-07-15T16:29:36Z",
"status": "NotStarted",
"createdDateTime": "2024-07-15T16:29:36Z",
"locale": "en-US",
"displayName": "My Endpoint",
"description": "My Endpoint Description"
}
応答本文の最上位の self プロパティはエンドポイントの URI です。 この URI を使用して、エンドポイントのプロジェクト、モデル、ログに関する詳細を取得します。 また、エンドポイントの更新または削除にもこの URI を使用します。
モデルの変更とエンドポイントの再デプロイ
エンドポイントは、同じ Speech リソースによって作成された別のモデルを使用するように更新できます。 前述のように、モデルの有効期限が切れる前に、エンドポイントのモデルを更新する必要があります。
新しいモデルを使用してカスタム エンドポイントを再デプロイするには:
- Speech Studio にサインインします。
- [Custom Speech]> プロジェクト名 >[モデルのデプロイ] を選択します。
- エンドポイントへのリンクを名前で選択し、[モデルの変更] を選択します。
- エンドポイントで使用する新しいモデルを選択します。
- [完了] を選択し、エンドポイントを保存して再デプロイします。
続行する前に、 Speech CLI がインストールされ、構成されていることを確認します。
新しいモデルでカスタム エンドポイントを再デプロイするには、spx csr model update コマンドを使用します。 次の手順に従って要求パラメーターを作成します。
- 必要な
endpointプロパティを、デプロイするエンドポイントの ID に設定します。 - 必要な
modelプロパティを、エンドポイントにデプロイするモデルの ID に設定します。
新しいモデルでカスタム エンドポイントを再デプロイする Speech CLI コマンドの例を次に示します。
spx csr endpoint update --api-version v3.2 --endpoint YourEndpointId --model YourModelId
重要
--api-version v3.2を設定する必要があります。 Speech CLI では REST API が使用されますが、 v3.2以降のバージョンはまだサポートされていません。
次の形式で応答本文を受け取る必要があります。
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/aaaabbbb-0000-cccc-1111-dddd2222eeee",
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/bbbbcccc-1111-dddd-2222-eeee3333ffff"
},
"links": {
"logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/a07164e8-22d1-4eb7-aa31-bf6bb1097f37/files/logs",
"restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/ccccdddd-2222-eeee-3333-ffff4444aaaa"
},
"properties": {
"loggingEnabled": true
},
"lastActionDateTime": "2024-07-15T16:30:12Z",
"status": "Succeeded",
"createdDateTime": "2024-07-15T16:29:36Z",
"locale": "en-US",
"displayName": "My Endpoint",
"description": "My Endpoint Description"
}
エンドポイントに関する Speech CLI ヘルプを表示するには、次のコマンドを実行します。
spx help csr endpoint
新しいモデルでカスタム エンドポイントをもう一度デプロイするには、Speech to text REST API の Endpoints_Update 操作を使用します。 次の手順に従って要求本文を作成します。
-
modelプロパティをエンドポイントにデプロイするモデルの ID に設定します。
HTTP PATCH 要求は、次の例に示すように URI を使って行います。
YourSpeechResoureKey を Speech リソースキーに置き換え、YourServiceRegion を Speech リソース領域に置き換え、YourEndpointId をエンドポイント ID に置き換え、前述のようにリクエスト本文のプロパティを設定します。
curl -v -X PATCH -H "Ocp-Apim-Subscription-Key: YourSpeechResoureKey" -H "Content-Type: application/json" -d '{
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/bbbbcccc-1111-dddd-2222-eeee3333ffff"
},
}' "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/YourEndpointId"
次の形式で応答本文を受け取る必要があります。
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/aaaabbbb-0000-cccc-1111-dddd2222eeee",
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/bbbbcccc-1111-dddd-2222-eeee3333ffff"
},
"links": {
"logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/a07164e8-22d1-4eb7-aa31-bf6bb1097f37/files/logs",
"restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/ccccdddd-2222-eeee-3333-ffff4444aaaa"
},
"properties": {
"loggingEnabled": true
},
"lastActionDateTime": "2024-07-15T16:30:12Z",
"status": "Succeeded",
"createdDateTime": "2024-07-15T16:29:36Z",
"locale": "en-US",
"displayName": "My Endpoint",
"description": "My Endpoint Description"
}
再デプロイが完了するまで、数分間かかります。 それまでの間、エンドポイントはサービスを中断することなく、以前のモデルを使用します。
ログ データを表示する
ログ データは、エンドポイントの作成時に構成した場合にエクスポートできます。
エンドポイント ログをダウンロードするには:
- Speech Studio にサインインします。
- [Custom Speech]> プロジェクト名 >[モデルのデプロイ] を選択します。
- リンクをエンドポイント名で選択します。
- [コンテンツ ログ] で、[ログのダウンロード] を選択します。
続行する前に、 Speech CLI がインストールされ、構成されていることを確認します。
エンドポイントのログを取得するには、spx csr endpoint list コマンドを使用します。 次の手順に従って要求パラメーターを作成します。
- 必要な
endpointプロパティを、ログを取得するエンドポイントの ID に設定します。
エンドポイントにログを取得する Speech CLI コマンドの例を次に示します。
spx csr endpoint list --api-version v3.2 --endpoint YourEndpointId
重要
--api-version v3.2を設定する必要があります。 Speech CLI では REST API が使用されますが、 v3.2以降のバージョンはまだサポートされていません。
各ログ ファイルの場所と詳細は、応答本文で返されます。
エンドポイントのログを取得するには、まず Speech to text REST API の Endpoints_Get 操作を使用します。
HTTP GET 要求は、次の例に示すように URI を使用して行います。
YourEndpointId をエンドポイント ID に置き換え、YourSpeechResoureKey を Speech リソース キーに置き換えて、YourServiceRegion を Speech リソース リージョンに置き換えます。
curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/YourEndpointId" -H "Ocp-Apim-Subscription-Key: YourSpeechResoureKey"
次の形式で応答本文を受け取る必要があります。
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/aaaabbbb-0000-cccc-1111-dddd2222eeee",
"model": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/bbbbcccc-1111-dddd-2222-eeee3333ffff"
},
"links": {
"logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/a07164e8-22d1-4eb7-aa31-bf6bb1097f37/files/logs",
"restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee",
"webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=aaaabbbb-0000-cccc-1111-dddd2222eeee"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/ccccdddd-2222-eeee-3333-ffff4444aaaa"
},
"properties": {
"loggingEnabled": true
},
"lastActionDateTime": "2024-07-15T16:30:12Z",
"status": "Succeeded",
"createdDateTime": "2024-07-15T16:29:36Z",
"locale": "en-US",
"displayName": "My Endpoint",
"description": "My Endpoint Description"
}
前の応答本文の "logs" URI を使用して HTTP GET 要求を行います。
YourEndpointId をエンドポイント ID に置き換え、YourSpeechResoureKey を Speech リソース キーに置き換えて、YourServiceRegion を Speech リソース リージョンに置き換えます。
curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.2/endpoints/YourEndpointId/files/logs" -H "Ocp-Apim-Subscription-Key: YourSpeechResoureKey"
各ログ ファイルの場所と詳細は、応答本文で返されます。
ログ データは、30 日間は Microsoft 所有のストレージ上で利用でき、その後削除されます。 自身のストレージ アカウントが Azure AI サービス サブスクリプションにリンクされている場合、ログ データは自動的には削除されません。