> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/yin-pin-yu-yu-yin/qwen3-tts.md).

# Qwen3-TTS 声音克隆

使用 Qwen3-TTS 进行多语言声音克隆和 TTS——支持 10+ 语言、流式输出、情感控制

阿里巴巴的 Qwen3-TTS 是一款最先进的文本转语音模型，支持 **10 多种语言** 仅需 3 秒音频即可进行声音克隆。它具备自然语言情感控制（“开心地说”，“轻声耳语”）、97 毫秒延迟的流式输出，以及两种模型规模（0.6B 和 1.7B）。在 Apache 2.0 许可下发布，是目前最强大的开源 TTS 系统之一。

## 主要特性

* **10 多种语言**: 英语、中文、日语、韩语、法语、德语、西班牙语等
* **3 秒声音克隆**: 仅需一小段音频样本即可克隆任意声音
* **自然情感控制**: 用纯文本指令控制风格
* **支持流式输出**: 97 毫秒首个 token 延迟——非常适合实时应用
* **两种规格**: 0.6B（4GB 显存）和 1.7B（8GB 显存）
* **可微调**: 提供可用于自定义训练的基础模型
* **Apache 2.0 许可证**：可用于商业用途

## 模型变体

| 模型                      | 参数   | 显存  | 质量 | 速度 | 最适合        |
| ----------------------- | ---- | --- | -- | -- | ---------- |
| Qwen3-TTS-0.6B-Instruct | 0.6B | 4GB | 好  | 快  | 实时、低成本 GPU |
| Qwen3-TTS-1.7B-Instruct | 1.7B | 8GB | 最佳 | 中等 | 生产级质量      |
| Qwen3-TTS-0.6B-Base     | 0.6B | 4GB | —  | —  | 微调         |
| Qwen3-TTS-1.7B-Base     | 1.7B | 8GB | —  | —  | 微调         |

## 需求

| 组件     | 0.6B         | 1.7B          |
| ------ | ------------ | ------------- |
| GPU    | RTX 3060 6GB | RTX 3080 10GB |
| 显存     | 4GB          | 8GB           |
| 内存     | 8GB          | 16GB          |
| 磁盘     | 5GB          | 10GB          |
| Python | 3.10+        | 3.10+         |

**推荐的 Clore.ai GPU**: RTX 3060（$0.03–0.07/小时）用于 0.6B，RTX 3080（$0.05–0.19/小时）用于 1.7B

## 安装

```bash
pip install transformers torch torchaudio soundfile
```

## 快速开始 — 声音克隆

```python
import torch
import torchaudio
from transformers import AutoModelForCausalLM, AutoProcessor

model_name = "Qwen/Qwen3-TTS-12Hz-1.7B-Instruct"
processor = AutoProcessor.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.float16,
    device_map="auto"
)

# 加载参考音色（3 秒以上的任意声音）
reference_audio, sr = torchaudio.load("reference_voice.wav")

# 生成克隆该声音的语音
text = "欢迎来到 Clore.ai，这个去中心化 GPU 租赁市场。"
inputs = processor(
    text=text,
    audio=reference_audio,
    sampling_rate=sr,
    return_tensors="pt"
).to("cuda")

with torch.no_grad():
    output = model.generate(**inputs, max_new_tokens=2048)

# 解码并保存
audio = processor.decode(output[0])
torchaudio.save("output.wav", audio.unsqueeze(0), 24000)
```

## 情感控制

```python
# 用自然语言指令控制情感
prompts = [
    ("开心且充满活力地说", "好消息！我们刚刚发布了新功能！"),
    ("轻柔地低声说", "让我告诉你一个关于 GPU 定价的秘密..."),
    ("专业且清晰地说", "季度业绩显示收入增长了 40%。"),
    ("带着兴奋说", "你绝对想不到基准测试结果！"),
]

for style, text in prompts:
    inputs = processor(
        text=text,
        style_prompt=style,
        audio=reference_audio,
        sampling_rate=sr,
        return_tensors="pt"
    ).to("cuda")
    
    output = model.generate(**inputs, max_new_tokens=2048)
    audio = processor.decode(output[0])
    torchaudio.save(f"output_{style[:10]}.wav", audio.unsqueeze(0), 24000)
```

## 多语言生成

```python
# 以不同语言生成（相同的声音！）
texts = {
    "en": "你好，欢迎来到 GPU 市场。",
    "zh": "你好，欢迎来到 GPU 市场。",
    "ja": "你好，欢迎来到 GPU 市场。",
    "ko": "你好，欢迎来到 GPU 市场。",
    "fr": "你好，欢迎来到 GPU 市场。",
    "de": "你好，欢迎来到 GPU 市场。",
}

for lang, text in texts.items():
    inputs = processor(
        text=text, audio=reference_audio, sampling_rate=sr,
        language=lang, return_tensors="pt"
    ).to("cuda")
    output = model.generate(**inputs, max_new_tokens=2048)
    audio = processor.decode(output[0])
    torchaudio.save(f"output_{lang}.wav", audio.unsqueeze(0), 24000)
```

## 与其他 TTS 模型的比较

| 功能   | Qwen3-TTS  | Zonos      | Dia        | Kokoro     | XTTS |
| ---- | ---------- | ---------- | ---------- | ---------- | ---- |
| 语言   | 10+        | 1（英语）      | 1（英语）      | 1（英语）      | 17   |
| 声音克隆 | 3 秒        | 2-30 秒     | 否          | 否          | 6 秒  |
| 流式输出 | ✅（97 毫秒）   | ❌          | ❌          | ❌          | ✅    |
| 情感控制 | ✅ 自然       | ❌          | ✅ 自动       | ❌          | ❌    |
| 多说话人 | ❌          | ❌          | ✅          | ❌          | ❌    |
| 最低显存 | 4GB        | 8GB        | 8GB        | 2GB        | 6GB  |
| 许可证  | Apache 2.0 | Apache 2.0 | Apache 2.0 | Apache 2.0 | AGPL |

## 给 Clore.ai 用户的建议

* **RTX 3060 上的 0.6B**: 最佳低成本选择，$0.03–0.07/小时——足以应对大多数 TTS 任务
* **批处理**: 在一个会话中生成所有音频片段，以最大化租用时长
* **缓存参考音频**: 将你的声音参考保存在持久化存储中
* **实时流式传输**: 在聊天机器人/助手应用中使用流式 API
* **为自定义声音进行微调**: 租用一张 RTX 4090 几小时，用你的声音数据对基础模型进行微调

## 故障排查

| 问题        | 解决方案                                     |
| --------- | ---------------------------------------- |
| 1.7B 显存不足 | 切换到 0.6B 或使用 `torch_dtype=torch.float16` |
| 声音克隆听起来不对 | 使用 5-10 秒干净音频（无背景噪音）                     |
| 输出语言错误    | 显式传入 `language` 参数                       |
| 首次生成较慢    | 正常——模型会在第一次调用时加载。后续调用会很快                 |

## 延伸阅读

* [HuggingFace 模型](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-1.7B-Instruct)
* [Qwen3-TTS 文档](https://qwen.readthedocs.io/)
* [声音克隆指南](https://medium.com/@zh.milo/qwen3-tts-the-complete-2026-guide)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/yin-pin-yu-yu-yin/qwen3-tts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
