部署自定義語音模型

在本文中,您將瞭解如何部署自定義語音模型的端點。 除了批次轉譯之外,您必須部署自定義端點以使用自定義語音模型。

提示

裝載的部署端點不需要搭配 Batch 轉譯 API 使用自定義語音。 如果自訂語音模型僅用於批次謄寫,則可以節省資源。 如需詳細資訊,請參閱 語音服務定價

您可以部署基底或自定義模型的端點,然後 稍後更新 端點,以使用較佳的定型模型。

注意

語音資源所使用的 F0 端點會在七天后刪除。

新增部署端點

若要建立自定義端點,請遵循下列步驟:

  1. 登入 Speech Studio

  2. 選取 [自定義語音> 您的項目名稱 >部署模型]。

    如果這是您的第一個端點,您會注意到資料表中沒有列出任何端點。 建立端點之後,您可以使用此頁面來追蹤每個已部署的端點。

  3. 選取 [部署模型 ] 以啟動新的端點精靈。

  4. 在 [ 新增端點 ] 頁面上,輸入自定義端點的名稱和描述。

  5. 選取要與端點建立關聯的自訂模型。

  6. 您可以選擇性地核取方塊,以啟用端點流量的音訊和診斷 記錄

    [新增端點] 頁面的螢幕快照,其中顯示啟用記錄的複選框。

  7. 選取 [新增 ] 以儲存並部署端點。

在主要 [部署模型 ] 頁面上,新端點的詳細數據會顯示在數據表中,例如名稱、描述、狀態和到期日。 最多可能需要 30 分鐘的時間,才能具現化使用自定義模型的新端點。 當部署狀態變更為 [成功] 時,端點已準備好使用。

重要

記下模型到期日。 這是您可以使用自訂模型進行語音辨識的最後一天。 如需詳細資訊,請參閱模型和端點生命週期

選取端點連結以檢視其特定資訊,例如端點密鑰、端點 URL 和範例程式代碼。

若要建立端點並部署模型,請使用 spx csr endpoint create 命令。 根據下列指示來建構要求參數:

  • project 參數設定為現有專案的識別碼。 建議您這麼做,以便您也可以在Speech Studio中檢視及管理端點。 您可以執行 spx csr project list 命令來取得可用的專案。
  • 將必要 model 參數設定為您要部署至端點之模型的標識碼。
  • 設定必要的 language 參數。 端點地區設定必須符合模型的地區設定。 稍後無法變更此地區設定。 語音 CLI language 參數會對應至 JSON 要求和回應中的 locale 屬性。
  • 設定必要的 name 參數。 這是在Speech Studio中顯示的名稱。 語音 CLI name 參數會對應至 JSON 要求和回應中的 displayName 屬性。
  • 您可以選擇性地設定 logging 參數。 將此設定為 enabled ,以啟用端點流量的音訊和診斷 記錄 。 預設值為 false

以下是用來建立端點及部署模型的範例語音 CLI 命令:

spx csr endpoint create --api-version v3.1 --project YourProjectId --model YourModelId --name "My Endpoint" --description "My Endpoint Description" --language "en-US"

您應該會收到下列格式的回應本文:

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/base/ae8d1643-53e4-4554-be4c-221dcfb471c5"
  },
  "links": {
    "logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790/files/logs",
    "restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790"
  },
  "project": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/projects/d40f2eb8-1abf-4f72-9008-a5ae8add82a4"
  },
  "properties": {
    "loggingEnabled": true
  },
  "lastActionDateTime": "2022-05-19T15:27:51Z",
  "status": "NotStarted",
  "createdDateTime": "2022-05-19T15:27:51Z",
  "locale": "en-US",
  "displayName": "My Endpoint",
  "description": "My Endpoint Description"
}

響應主體中的最上層 self 屬性是端點的 URI。 使用此 URI 來取得端點專案、模型和記錄的詳細數據。 您也可以使用此 URI 來更新端點。

針對端點的語音 CLI 說明,請執行下列命令:

spx help csr endpoint

若要建立端點並部署模型,請使用語音轉換文字 REST APIEndpoints_Create 作業。 根據下列指示來建構要求本文:

  • project 屬性設定為現有專案的 URI。 建議您這麼做,以便您也可以在Speech Studio中檢視及管理端點。 您可以提出 Projects_List 要求以取得可用的專案。
  • 將必要 model 屬性設定為您要部署至端點之模型的 URI。
  • 設定必要的 locale 屬性。 端點地區設定必須符合模型的地區設定。 稍後無法變更此地區設定。
  • 設定必要的 displayName 屬性。 這是在Speech Studio中顯示的名稱。
  • 您可以選擇性地在 內properties設定 loggingEnabled 屬性。 將此設定為 true ,以啟用端點流量的音訊和診斷 記錄 。 預設值為 false

使用 URI 提出 HTTP POST 要求,如下列 Endpoints_Create 範例所示。 以您的語音資源金鑰取代 YourSubscriptionKey、以您的語音資源區域取代 YourServiceRegion,並設定要求本文屬性,如前所述。

curl -v -X POST -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey" -H "Content-Type: application/json" -d '{
  "project": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/projects/d40f2eb8-1abf-4f72-9008-a5ae8add82a4"
  },
  "properties": {
    "loggingEnabled": true
  },
  "displayName": "My Endpoint",
  "description": "My Endpoint Description",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/base/ae8d1643-53e4-4554-be4c-221dcfb471c5"
  },
  "locale": "en-US",
}'  "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints"

您應該會收到下列格式的回應本文:

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/base/ae8d1643-53e4-4554-be4c-221dcfb471c5"
  },
  "links": {
    "logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790/files/logs",
    "restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790"
  },
  "project": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/projects/d40f2eb8-1abf-4f72-9008-a5ae8add82a4"
  },
  "properties": {
    "loggingEnabled": true
  },
  "lastActionDateTime": "2022-05-19T15:27:51Z",
  "status": "NotStarted",
  "createdDateTime": "2022-05-19T15:27:51Z",
  "locale": "en-US",
  "displayName": "My Endpoint",
  "description": "My Endpoint Description"
}

響應主體中的最上層 self 屬性是端點的 URI。 使用此 URI 來 取得 端點專案、模型和記錄的詳細數據。 您也可以使用此 URI 來更新或刪除端點。

變更模型並重新部署端點

您可以更新端點,以使用相同語音資源所建立的另一個模型。 如先前所述,您必須在模型到期之前更新端點的模型。

若要使用新的模型並重新部署自訂端點:

  1. 登入 Speech Studio
  2. 選取 [自定義語音> 您的項目名稱 >部署模型]。
  3. 依名稱選取端點的連結,然後選取 [變更模型]。
  4. 選取您想要端點使用的新模型。
  5. 選取 [ 完成] 以儲存並重新部署端點。

若要使用新的模型重新部署自定義端點,請使用 spx csr model update 命令。 根據下列指示來建構要求參數:

  • 將必要的 endpoint 參數設定為您想要部署之端點的標識碼。
  • 將必要 model 參數設定為您要部署至端點之模型的標識碼。

以下是使用新模型重新部署自訂端點的範例語音 CLI 命令:

spx csr endpoint update --api-version v3.1 --endpoint YourEndpointId --model YourModelId

您應該會收到下列格式的回應本文:

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/1e47c19d-12ca-4ba5-b177-9e04bd72cf98"
  },
  "links": {
    "logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790/files/logs",
    "restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790"
  },
  "project": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/projects/639d5280-8995-40cc-9329-051fd0fddd46"
  },
  "properties": {
    "loggingEnabled": true
  },
  "lastActionDateTime": "2022-05-19T23:01:34Z",
  "status": "NotStarted",
  "createdDateTime": "2022-05-19T15:41:27Z",
  "locale": "en-US",
  "displayName": "My Endpoint",
  "description": "My Updated Endpoint Description"
}

針對端點的語音 CLI 說明,請執行下列命令:

spx help csr endpoint

若要使用新模型重新部署自訂端點,請使用語音轉換文字 REST APIEndpoints_Update 作業。 根據下列指示來建構要求本文:

  • model 屬性設定為您要部署至端點之模型的 URI。

使用 URI 提出 HTTP PATCH 要求,如下列範例所示。 將 取代 YourSubscriptionKey 為您的語音資源密鑰、以語音資源區域取代、以端點標識碼取代 YourServiceRegionYourEndpointId ,以及如先前所述設定要求本文屬性。

curl -v -X PATCH -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey" -H "Content-Type: application/json" -d '{
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/1e47c19d-12ca-4ba5-b177-9e04bd72cf98"
  }
}'  "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/YourEndpointId"

您應該會收到下列格式的回應本文:

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/1e47c19d-12ca-4ba5-b177-9e04bd72cf98"
  },
  "links": {
    "logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790/files/logs",
    "restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790"
  },
  "project": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/projects/639d5280-8995-40cc-9329-051fd0fddd46"
  },
  "properties": {
    "loggingEnabled": true
  },
  "lastActionDateTime": "2022-05-19T23:01:34Z",
  "status": "NotStarted",
  "createdDateTime": "2022-05-19T15:41:27Z",
  "locale": "en-US",
  "displayName": "My Endpoint",
  "description": "My Updated Endpoint Description"
}

重新部署需要幾分鐘的時間才能完成。 同時,您的端點會使用先前的模型,而不會中斷服務。

檢視記錄數據

如果您在建立端點時加以設定,則可以匯出記錄數據。

若要下載端點記錄:

  1. 登入 Speech Studio
  2. 選取 [自定義語音> 您的項目名稱 >部署模型]。
  3. 依端點名稱選取連結。
  4. 在 [內容記錄] 底下,選取 [下載記錄]。

若要取得端點的記錄,請使用 spx csr endpoint list 命令。 根據下列指示來建構要求參數:

  • 將必要 endpoint 參數設定為您要取得記錄之端點的標識碼。

以下是可取得端點記錄的範例語音 CLI 命令:

spx csr endpoint list --api-version v3.1 --endpoint YourEndpointId

回應本文中會傳回每個記錄檔的位置,其中包含更多詳細數據。

若要取得端點的記錄,請先使用語音轉換文字 REST APIEndpoints_Get 作業。

使用 URI 提出 HTTP GET 要求,如下列範例所示。 將 取代為您的端點標識碼、將 取代YourEndpointIdYourSubscriptionKey為您的語音資源密鑰,並將 取代YourServiceRegion為您的語音資源區域。

curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/YourEndpointId" -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey"

您應該會收到下列格式的回應本文:

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/1e47c19d-12ca-4ba5-b177-9e04bd72cf98"
  },
  "links": {
    "logs": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/98375aaa-40c2-42c4-b65c-f76734fc7790/files/logs",
    "restInteractive": "https://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restConversation": "https://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "restDictation": "https://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketInteractive": "wss://eastus.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketConversation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790",
    "webSocketDictation": "wss://eastus.stt.speech.microsoft.com/speech/recognition/dictation/cognitiveservices/v1?cid=98375aaa-40c2-42c4-b65c-f76734fc7790"
  },
  "project": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/projects/2f78cdb7-58ac-4bd9-9bc6-170e31483b26"
  },
  "properties": {
    "loggingEnabled": true
  },
  "lastActionDateTime": "2022-05-19T23:41:05Z",
  "status": "Succeeded",
  "createdDateTime": "2022-05-19T23:41:05Z",
  "locale": "en-US",
  "displayName": "My Endpoint",
  "description": "My Updated Endpoint Description"
}

使用先前回應本文中的「記錄」URI 提出 HTTP GET 要求。 將 取代為您的端點標識碼、將 取代YourEndpointIdYourSubscriptionKey為您的語音資源密鑰,並將 取代YourServiceRegion為您的語音資源區域。

curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.1/endpoints/YourEndpointId/files/logs" -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey"

回應本文中會傳回每個記錄檔的位置,其中包含更多詳細數據。

記錄數據可在 Microsoft 擁有的記憶體上取得 30 天,然後移除。 如果您自己的記憶體帳戶連結到 Azure AI 服務訂用帳戶,則記錄數據不會自動刪除。

下一步