Deploying real-time personalized speech with Qwen3-TTS on Amazon SageMaker AI
https://aws.amazon.com/blogs/machine-learning/deploying-real-time-personalized-speech-with-qwen3-tts-on-amazon-sagemaker-ai/📌 用 Qwen3-TTS 在 SageMaker 打造即時語音克隆服務
TL;DR:AWS 展示如何把開源 Qwen3-TTS-12Hz-1.7B-Base 部署到 SageMaker 即時端點,用幾秒鐘參考音檔就能複製聲音並跨語言合成。
只要一段幾秒鐘的錄音和對應逐字稿,模型就能用這個人的聲音唸出任何新文字,甚至換成另一種語言——而且完全不需要重新訓練模型。
🤔 語音克隆要解決的問題
Voice cloning 能從一小段參考錄音重現特定說話者的聲音特徵,不必重新訓練模型。文章指出,媒體團隊、教育工作者與應用程式開發者可以用這個能力打造個人化語音體驗、將多語系內容在地化,同時支援無障礙溝通,並在跨語言情境下保留說話者的聲音身份。採用自行架設的公開模型,能自行掌控成本、讓語音資料留在自己的 AWS 環境中,也能依領域需求進一步調整;而透過 Amazon SageMaker AI 部署,基礎設施佈建、健康監控與自動擴縮都交給平臺管理,不需要自己維運底層的 GPU 伺服器。
🧩 模型與部署架構
Qwen3-TTS 是阿里雲 Qwen 團隊開發的公開 text-to-speech 模型家族,涵蓋中文、英文、日文、韓文、德文、法文、俄文、葡萄牙文、西班牙文、義大利文共 10 種語言,使用 Qwen3-TTS-Tokenizer-12Hz 語音分詞器,並支援串流生成以因應低延遲的互動情境。本文部署的是 Base 版本 Qwen3-TTS-12Hz-1.7B-Base,只需使用者提供的幾秒鐘音檔即可做語音克隆,也可作為 fine-tuning 的基底;這與另一個 CustomVoice 版本不同,後者是從一組固定的預設語者中生成語音,而非依使用者提供的參考音檔克隆。模型也支援跨語言克隆:可以用一種語言的參考音檔擷取聲音特徵,再用另一種語言生成語音,同時保留原說話者的音色。
在 SageMaker JumpStart 中,Qwen3-TTS-12Hz-1.7B-Base 與 Qwen3-TTS-12Hz-1.7B-CustomVoice、Qwen3-ASR-1.7B 一起提供,直接用 JumpStart 提供的模型檔案與預建服務容器部署,不需要自己撰寫推論處理程式。部署方式是建立一個 JumpStartModel 物件並呼叫 deploy,執行時需要帶入 SageMaker 執行角色的 ARN;端點需要幾分鐘才會進入 InService 狀態,因為容器要把模型載入 GPU。模型內部分成兩個階段在同一張 GPU 上運行:talker 與 code2wav,最終輸出 24 kHz 的音訊。
GPU 記憶體是部署時最容易出包的地方。 vLLM 會依 gpu_memory_utilization 這個參數預先保留 GPU 記憶體,而 talker 與 code2wav 兩個階段共用同一張 GPU,因此兩者保留量加總必須留在 GPU 容量之內。文章建議兩階段各設為 0.45(0.45+0.45=0.90,留約 10% 緩衝)。容器啟動時,每個階段都會把記憶體用量記錄到 CloudWatch Logs:talker 權重約 3.66 GiB,code2wav 權重約 0.45 GiB,模型權重本身都不大,大部分配額其實變成了 KV cache,也就是暫存 in-flight 請求 token 的工作記憶體。在一張 24GB GPU、0.45 利用率下(約 22GiB 可用),每個階段可用到約 10GiB,兩階段合計仍有餘裕——這也是為什麼 24GB GPU(g6 家族、NVIDIA L4)就足以撐起這顆 1.7B 模型,不需要更大的 GPU。
呼叫端點時,有兩個 JumpStart 容器特有的細節必須注意:參考音檔要先轉成 24 kHz 單聲道 WAV,再編碼成 data:audio/wav;base64,… 格式;呼叫時還要帶上 CustomAttributes 路由參數,請求才能正確打到 text-to-speech 的 handler。回傳的音訊格式由 response_format 控制,文章示範用 “wav”,模型會生成 24 kHz 單聲道音訊。單一請求適合處理一句話或一小段文字;較長的內容,例如整篇文章或多行腳本,建議拆成每句或每段各發一次請求,以維持整段語音的一致性。
📊 如何選擇 instance 與估算容量
文章建議依三步驟選擇 instance:先確認 JumpStart 是否支援該機型,再檢查帳號的 service quota,最後確認 GPU 記憶體是否放得下模型。對這顆 1.7B 模型而言,24GB GPU(g6 家族、NVIDIA L4)既相符又划算。若要估算可同時服務多少請求,可以查看端點日誌群組(路徑為 /aws/sagemaker/Endpoints/
🎯 實務啟示
對想在自己的應用中加入個人化、多語系語音功能又不想自行維運 GPU 基礎設施的工程團隊來說,JumpStart 的預建容器省下了自寫推論處理程式的功夫;而這類「同一張 GPU 跑兩階段模型」的部署,GPU 記憶體配置往往是最容易踩雷的環節,值得先照文章示範的 0.45/0.45 設定在小型 GPU 上驗證是否留有足夠緩衝,再依 CloudWatch 記錄的 KV cache 預算評估要不要擴大 instance 規模。
🔗 來源
- 標題:Deploying real-time personalized speech with Qwen3-TTS on Amazon SageMaker AI
- 作者/機構:Suneesh T,AWS Machine Learning Blog
- 連結:https://aws.amazon.com/blogs/machine-learning/deploying-real-time-personalized-speech-with-qwen3-tts-on-amazon-sagemaker-ai/
#TextToSpeech #VoiceCloning #Qwen3TTS #AmazonSageMaker #AWSMachineLearning #SpeechAI #MultilingualAI #vLLM #GenerativeAudio #MLDeployment
原始資料 AWS ML · 收集於 2026-09-25
摘要原文
With voice cloning, you can generate new speech in a target speaker’s voice from a short reference recording, without retraining a model. You can now deploy the publicly available Qwen3-TTS-12Hz-1.7B-Base text-to-speech model from Amazon SageMaker JumpStart to a fully managed, real-time inference endpoint. Voice cloning reproduces the vocal identity of a specific speaker. Start with a short recording of the speaker and its transcript. Then supply the new text to synthesize. The model speaks that text in the reference speaker’s voice, without retraining. Media teams, educators, and application developers can use this capability to create personalized voice experiences and localize multilingual content. They can also support accessible communication and preserve a speaker’s identity across languages. With a self-hosted, publicly available voice cloning model, you control cost and keep audio data within your AWS environment. You can also adapt the model to your domain. With Amazon SageMaker AI , you can run the model on a fully managed real-time endpoint and handle infrastructure provisioning, health monitoring, and automatic scaling. You don’t manage the underlying GPU servers. This post shows how to deploy Qwen3-TTS-12Hz-1.7B-Base from Amazon SageMaker JumpStart using the Amazon SageMaker Python SDK , and how to invoke the resulting endpoint to clone a voice from a reference clip. It also covers the configuration settings that make this deployment work in practice, along with the Amazon CloudWatch metrics you can use to monitor and right-size the endpoint. Qwen3-TTS is a publicly available text-to-speech model family developed by the Qwen team at Alibaba Cloud. It covers 10 languages: Chinese, English, Japanese, Korean, German, French, Russian, Portuguese, Spanish, and Italian. The models use the Qwen3-TTS-Tokenizer-12Hz speech tokenizer and support streaming generation for low-latency, interactive scenarios. This post uses the Base variant, Qwen3-TTS-12Hz-1.7B-Base . It performs voice cloning from only a few seconds of user audio. It can also serve as a base for fine-tuning. For voice cloning, the model takes a reference audio clip and its transcript. It captures the speaker’s vocal characteristics, such as timbre, pitch, and cadence, and applies them to new text. This differs from the CustomVoice variant, which generates speech from a fixed set of predefined speakers rather than a user-supplied reference. The model also supports cross-lingual cloning: You can capture a voice from a reference in one language and generate speech in another while preserving the speaker’s vocal identity. Qwen3-TTS-12Hz-1.7B-Base is available in Amazon SageMaker JumpStart alongside Qwen3-TTS-12Hz-1.7B-CustomVoice and Qwen3-ASR-1.7B. With these JumpStart options, you can use the streamlined deployment shown in this post. With voice cloning, applications can reproduce the vocal identity of a chosen speaker from a reference recording, rather than being limited to a fixed set of predefined voices. This supports a range of use cases across media, customer engagement, education, and conversational AI. Key benefits of this deployment approach include: Common applications for voice cloning include: This solution deploys Qwen3-TTS-12Hz-1.7B-Base from Amazon SageMaker JumpStart to a real-time endpoint. JumpStart provides the model artifacts and a pre-built serving container, so you don’t write a custom inference handler. You construct a JumpStartModel object, call its deploy method, and invoke the resulting endpoint with the Amazon SageMaker runtime client. The JumpStart container serves the model to generate 24 kHz audio output from text input. This stage design affects how you size GPU memory, as the following section explains. The following diagram shows the real-time inference architecture for the deployment. Figure 1: Real-time voice cloning architecture on Amazon SageMaker AI The deployment follows the standard Amazon SageMaker AI real-time inference pattern: Before you begin, confirm that you have the following resources and permissions: Construct a JumpStartModel with the model ID and deploy it. The GPU memory override is the most important setting for this deployment. The following section explains how to configure it. Before running the following code, replace <sagemaker-execution-role-arn> with the ARN of the IAM execution role that Amazon SageMaker AI uses to deploy the model. The endpoint takes several minutes to reach the InService status while the container loads the model onto the GPU. You can monitor the endpoint status in the Amazon SageMaker AI console or by calling the describe_endpoint API. As described earlier, the model runs as two stages (talker and code2wav) on the same GPU. vLLM reserves GPU memory up front based on gpu_memory_utilization , the fraction of GPU memory a stage can claim. Both stages share one GPU. To avoid out-of-memory errors during startup, keep their combined reservation within the GPU’s capacity. Set the value so the two stages together fit comfortably. With one shared setting applied equally to both stages, 0.45 works well (0.45 + 0.45 = 0.90, leaving a approximately 10 percent buffer): At container startup, each stage logs its memory use to the endpoint’s log group in Amazon CloudWatch Logs. The following values confirm the model fits well within a 24 GB GPU: The model weights are small (3.66 GiB for the talker and 0.45 GiB for code2wav). Most of the remaining memory each stage is allowed becomes KV cache, the working memory that holds tokens for in-flight requests. At a utilization of 0.45 on a 24 GB GPU (about 22 GiB usable), each stage can use up to roughly 10 GiB. Together, the two stages fit within the GPU with headroom to spare. This is why a 24 GB GPU is well suited to the 1.7B model, and a larger GPU is not required. With the endpoint InService , test voice cloning. Two details are specific to this JumpStart container and are essential to get a response: Audio formats. Provide the reference clip as a base64-encoded data:audio/wav;base64,... URI. Converting the reference to 24 kHz mono WAV before encoding is the recommended input form. The endpoint returns audio in the format you request through response_format . This post uses "wav" , and the model generates 24 kHz mono audio. The following code converts the reference clip and base64-encodes it: Invoke the endpoint with the target text in input and the reference clip in ref_audio . Note the CustomAttributes routing argument, which is required to reach the text-to-speech handler: The preceding request is the most basic case: one sentence of text returned as speech in the cloned voice. The following patterns build on it, using the same ref_audio , ref_text , and route custom attribute. Sample audio for this example (open the files provided with this post): Reference input: reference_original_input.wav Generated output: cloned_output.wav A single request works well for one sentence or a short passage. For longer content, such as an article or a multi-line script, split it and send one request per sentence or paragraph so the voice stays consistent throughout. To produce speech in a different language while keeping the same voice, use the same reference clip and set "language" to another supported language. The following example uses the English reference to generate Chinese speech, preserving the speaker’s vocal identity across languages. Generated output: cross_lingual_cloning.wav Choose an instance in three steps. First, confirm that JumpStart supports it. Then, check your service quota and confirm that its GPU memory fits the model. For a 1.7B model, a 24 GB GPU (the g6 family, NVIDIA L4) is well matched and cost effective. To estimate concurrent request capacity, check the KV cache token budget in the endpoint’s log group in Amazon CloudWatch Logs. The log group path is /aws/sagemaker/Endpoints/<endpoint-name> .
由 claude-code/sonnet 自動生成