共用方式為


部署自訂語音模型

在本文中,您會了解如何部署自訂語音模型的端點。 除了批次轉錄外,您必須部署自訂端點以使用自訂語音模型。

秘訣

無需託管部署端點,也能將自訂語音與批次轉錄 API 搭配使用。 如果自訂語音模型僅用於批次轉錄,則可以節省資源。 如需詳細資訊,請參閱語音服務價格

您可以部署基本或自訂模型的端點,然後在稍後更新端點,以使用更好的定型模型。

附註

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

新增部署端點

秘訣

將你自訂的語音模型從 Speech Studio 帶到 Microsoft Foundry 入口網站。 在 Microsoft Foundry 入口網站中,你可以連接現有的語音資源,繼續上次的作業。 如需連線到現有語音資源的詳細資訊,請參閱 連線到現有的語音資源

  1. 登入 Microsoft Foundry 入口網站

  2. 從左窗格中選取 [ 微調 ],然後選取 [AI 服務微調]。

  3. 請選取您根據《如何啟動自訂語音微調》一文中指示啟動的自訂語音微調任務 (依模型名稱)。

  4. 選取 [部署模型>+ 部署模型]。

    頁面的螢幕擷取畫面,其中包含部署自訂語音模型的選項。

  5. 在 [部署新的模型] 精靈中,選取您要部署的模型。

    頁面的螢幕擷取畫面,其中包含選取您所要部署模型的選項。

  6. 輸入部署的名稱和描述。 選取方塊以同意使用規定。 然後選取 [部署]

  7. 部署狀態為 [成功] 之後,您即可檢視部署詳細資料。 選取部署以檢視端點識別碼等詳細資料。

    頁面的螢幕擷取畫面,其中包含選取部署的選項,以檢視端點識別碼等詳細資料。

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

  1. 登入 Speech Studio

  2. 選取自訂語音>您的專案名稱>部署模型

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

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

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

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

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

    [新增端點] 頁面的螢幕擷取畫面,其中顯示啟用記錄的核取方塊。

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

在主要 [部署模型] 頁面上,新端點的詳細資料會顯示在資料表中,例如名稱、描述、狀態和到期日。 具現化使用自訂模型的新端點,最多需要 30 分鐘的時間。 當部署狀態變更為 [成功] 時,端點就可供使用了。

重要事項

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

選取端點連結以查看該端點的特定資訊,例如端點金鑰、端點 URL 和範例程式碼。

繼續之前,請確定您已安裝並設定 語音 CLI

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

  • project 屬性設定為現有項目的識別碼。 建議使用此功能 project ,方便你在 Microsoft Foundry 入口網站中管理自訂語音的微調。 若要取得專案識別碼,請參閱 取得 REST API 檔的專案識別碼
  • 將必要的 model 屬性設定為您要部署至端點的模型識別碼。
  • 設定必要的 language 屬性。 端點地區設定必須符合模型的地區設定。 稍後無法變更此地區設定。 Speech CLI 的 language 屬性對應於 JSON 要求和回應中的 locale 屬性。
  • 設定必要的 name 屬性。 這是 Microsoft Foundry 入口網站中顯示的名稱。 Speech CLI 的 name 屬性對應於 JSON 要求和回應中的 displayName 屬性。
  • 您可以選擇性地設定 logging 屬性。 將此參數設定為 enabled,以啟用端點流量的音訊和診斷記錄。 預設值為 false

以下是建立端點和部署模型的範例語音 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。 語音 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 來更新端點。

如需在端點使用語音 CLI 的說明,請執行下列命令:

spx help csr endpoint

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

  • project 屬性設定為現有專案的 URI。 建議使用此特性,讓您也能在 Microsoft Foundry 入口網站中查看和管理端點。 若要取得專案識別碼,請參閱 取得 REST API 檔的專案識別碼
  • 將必要的 model 屬性設定為您要部署至端點的模型 URI。
  • 設定必要的 locale 屬性。 端點地區設定必須符合模型的地區設定。 稍後無法變更此地區設定。
  • 設定必要的 displayName 屬性。 這是 Microsoft Foundry 入口網站中顯示的名稱。
  • 您可以選擇是否要在 loggingEnabled 中設定 properties 屬性。 將此參數設定為 true,以啟用端點流量的音訊和診斷記錄。 預設值為 false

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

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 來更新刪除端點。

變更模型並重新部署端點

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

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

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

繼續之前,請確定您已安裝並設定 語音 CLI

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

  • 將必要的 endpoint 屬性設定為您要部署的端點識別碼。
  • 將必要的 model 屬性設定為您要部署至端點的模型識別碼。

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

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

重要事項

您必須設定 --api-version v3.2。 語音 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"
}

如需在端點使用語音 CLI 的說明,請執行下列命令:

spx help csr endpoint

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

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

使用 URI 提出 HTTP PATCH 要求,如下列範例所示。 以您的語音資源金鑰取代 YourSpeechResoureKey、以語音資源區域取代 YourServiceRegion、以端點識別碼取代 YourEndpointId,然後設定要求本文屬性,如前所述。

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"
}

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

檢視記錄資料

如果您在建立端點時設定記錄資料,則可以匯出該資料。

若要下載端點記錄:

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

繼續之前,請確定您已安裝並設定 語音 CLI

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

  • 將必要的 endpoint 屬性設定為您要取得記錄的端點識別碼。

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

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

重要事項

您必須設定 --api-version v3.2。 語音 CLI 會使用 REST API,但尚未支援 v3.2 後續版本。

回應本文會傳回每個記錄檔的位置及其詳細資料。

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

使用 URI 提出 HTTP GET 要求,如下列範例所示。 以您的端點識別碼取代 YourEndpointId、以語音資源金鑰取代 YourSpeechResoureKey,並以語音資源區域取代 YourServiceRegion

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"
}

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

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

回應本文會傳回每個記錄檔的位置及其詳細資料。

記錄資料會在 Microsoft 擁有的儲存體上保留 30 天以供使用,之後會將其移除。 如果你自己的儲存帳號連結到 Foundry Tools 訂閱,日誌資料不會自動刪除。