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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PilotTTS: A Disciplined Modular Recipe for Competitive Speech Synthesis
|
| 2 |
+
|
| 3 |
+
<div align="center">
|
| 4 |
+
<img src="assert/Introduction.png" width="600" />
|
| 5 |
+
</div>
|
| 6 |
+
|
| 7 |
+
<p align="center">
|
| 8 |
+
English | <a href="README_zh.md">中文</a>
|
| 9 |
+
</p>
|
| 10 |
+
|
| 11 |
+
<p align="center">
|
| 12 |
+
📑 <a href="#">Paper</a> | 🤗 <a href="https://huggingface.co/AmapVoice/PilotTTS">HuggingFace</a> | 🤖 <a href="https://www.modelscope.cn/models/AmapVoice/PilotTTS">ModelScope</a> | 🎧 <a href="https://amapvoice.github.io/PilotTTS/">Demos</a>
|
| 13 |
+
</p>
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
## News 📝
|
| 17 |
+
|
| 18 |
+
- **[2025.05]** Release Pilot-TTS base and instruct model weights
|
| 19 |
+
|
| 20 |
+
## Highlight 🔥
|
| 21 |
+
|
| 22 |
+
**PilotTTS** is an LLM-based text-to-speech (TTS) system that builds an intentionally simplified architecture with fully open-source components and achieves competitive performance through rigorous data engineering.
|
| 23 |
+
|
| 24 |
+
### Key Features
|
| 25 |
+
- **A fully open-source data processing pipeline:** We design a multi-stage pipeline that incorporates quality assessment and enhancement, annotation, and quality filtering, where all operators are implemented using publicly available tools. This pipeline converts large-scale Internet audio into clean training data with rich annotation, achieving high-quality data generation while substantially reducing costs.
|
| 26 |
+
- **Content Consistency and Speaker Similarity Control:** On the Seed-TTS test set, our model achieves state-of-the-art speaker similarity (0.862) and highly competitive content accuracy (CER 0.87%).
|
| 27 |
+
- **Emotion and Paralinguistic Control:** Supports controllable synthesis for 11 emotion categories (Happy, Sad, Fear, Angry, Contempt, Serious, Surprise, Blue, Concern, Disgust, Psychology) and 4 paralinguistic categories (LAUGH, BREATH, CRY, COUGH).
|
| 28 |
+
- **Dialect Control:** Supports 14 Chinese dialects and enables cross-dialect synthesis, with particular strength in synthesizing from Mandarin Chinese to the target dialect.
|
| 29 |
+
|
| 30 |
+
## Installation ⚙️
|
| 31 |
+
|
| 32 |
+
### Clone and install
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
git clone https://github.com/xxx/pilot-tts.git
|
| 36 |
+
cd pilot-tts
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### Environment setup
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
conda create -n pilot-tts python=3.10 -y
|
| 43 |
+
conda activate pilot-tts
|
| 44 |
+
pip install -r requirements.txt
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### Model download
|
| 48 |
+
|
| 49 |
+
#### 1. Pilot-TTS models (our weights)
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
# ModelScope
|
| 53 |
+
from modelscope import snapshot_download
|
| 54 |
+
snapshot_download('xxx/Pilot-TTS', local_dir='pretrained_models/')
|
| 55 |
+
|
| 56 |
+
# HuggingFace
|
| 57 |
+
from huggingface_hub import snapshot_download
|
| 58 |
+
snapshot_download('xxx/Pilot-TTS', local_dir='pretrained_models/')
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
This includes: `pilot_tts.pt`, `pilot_tts_instruct.pt`, and `tokenizer/`.
|
| 62 |
+
|
| 63 |
+
#### 2. Third-party open-source models
|
| 64 |
+
|
| 65 |
+
Download the following dependencies from their respective open-source projects:
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from modelscope import snapshot_download
|
| 69 |
+
|
| 70 |
+
# Qwen3-0.6B (LLM backbone)
|
| 71 |
+
snapshot_download('Qwen/Qwen3-0.6B', local_dir='pretrained_models/Qwen3-0.6B')
|
| 72 |
+
|
| 73 |
+
# CosyVoice3 (flow-matching vocoder, includes campplus.onnx)
|
| 74 |
+
snapshot_download('FunAudioLLM/Fun-CosyVoice3-0.5B-2512', local_dir='pretrained_models/CosyVoice3-0.5B')
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from huggingface_hub import snapshot_download
|
| 79 |
+
|
| 80 |
+
# w2v-bert-2.0 (audio feature extractor)
|
| 81 |
+
snapshot_download('facebook/w2v-bert-2.0', local_dir='pretrained_models/w2v-bert-2.0')
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
> Note: `wav2vec2bert_stats.pt` (from [MaskGCT](https://github.com/open-mmlab/Amphion/tree/main/models/tts/maskgct)) is included in the Pilot-TTS model package.
|
| 85 |
+
|
| 86 |
+
#### Final directory structure
|
| 87 |
+
|
| 88 |
+
```
|
| 89 |
+
pretrained_models/
|
| 90 |
+
├── pilot_tts.pt # Base model (zero-shot voice cloning)
|
| 91 |
+
├── pilot_tts_instruct.pt # Instruct model (emotion, paralanguage, dialect)
|
| 92 |
+
├── Qwen3-0.6B/ # LLM backbone (from Qwen)
|
| 93 |
+
├── w2v-bert-2.0/ # Audio feature extractor (from Meta)
|
| 94 |
+
├── wav2vec2bert_stats.pt # Feature normalization stats (from MaskGCT)
|
| 95 |
+
└── CosyVoice3-0.5B/ # Flow-matching vocoder (from FunAudioLLM)
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
## Quick Start 📖
|
| 99 |
+
|
| 100 |
+
Run all inference demos with a single command:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
python demo.py
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## Inference
|
| 107 |
+
|
| 108 |
+
### Python API
|
| 109 |
+
|
| 110 |
+
```python
|
| 111 |
+
from demo import load_engine, synthesize
|
| 112 |
+
|
| 113 |
+
# Zero-shot voice cloning (base model)
|
| 114 |
+
engine = load_engine(
|
| 115 |
+
config_path="configs/infer_pilot_tts.yaml",
|
| 116 |
+
checkpoint="pretrained_models/pilot_tts.pt",
|
| 117 |
+
)
|
| 118 |
+
synthesize(engine, text="你好,世界!",
|
| 119 |
+
prompt_wav="assert/prompt.wav",
|
| 120 |
+
output_path="output/clone.wav")
|
| 121 |
+
|
| 122 |
+
# Load instruct model (emotion, paralanguage, dialect)
|
| 123 |
+
engine_instruct = load_engine(
|
| 124 |
+
config_path="configs/infer_pilot_tts_instruct.yaml",
|
| 125 |
+
checkpoint="pretrained_models/pilot_tts_instruct.pt",
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
# Emotion synthesis
|
| 129 |
+
synthesize(engine_instruct, text="今天天气真好啊!",
|
| 130 |
+
prompt_wav="assert/prompt.wav",
|
| 131 |
+
emotion="happy", output_path="output/happy.wav")
|
| 132 |
+
|
| 133 |
+
# Paralanguage
|
| 134 |
+
synthesize(engine_instruct, text="这太好笑了<|LAUGH|>停不下来",
|
| 135 |
+
prompt_wav="assert/prompt.wav",
|
| 136 |
+
output_path="output/laugh.wav")
|
| 137 |
+
|
| 138 |
+
# Dialect (Henan)
|
| 139 |
+
synthesize(engine_instruct, text="中不中啊,咱俩一块儿去吃胡辣汤吧",
|
| 140 |
+
prompt_wav="assert/prompt.wav",
|
| 141 |
+
language="zh-henan", output_path="output/henan.wav")
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
### Command Line
|
| 145 |
+
|
| 146 |
+
```bash
|
| 147 |
+
# Zero-shot voice cloning (base model)
|
| 148 |
+
python inference.py \
|
| 149 |
+
--checkpoint pretrained_models/pilot_tts.pt \
|
| 150 |
+
--prompt-wav assert/prompt.wav \
|
| 151 |
+
--text "需要合成的目标文本" \
|
| 152 |
+
--output output/zeroshot.wav
|
| 153 |
+
|
| 154 |
+
# Emotion synthesis (instruct model)
|
| 155 |
+
python inference.py \
|
| 156 |
+
--config configs/infer_pilot_tts_instruct.yaml \
|
| 157 |
+
--checkpoint pretrained_models/pilot_tts_instruct.pt \
|
| 158 |
+
--prompt-wav assert/prompt.wav \
|
| 159 |
+
--text "今天天气真好啊,我们去公园玩吧!" \
|
| 160 |
+
--emotion happy \
|
| 161 |
+
--output output/emotion.wav
|
| 162 |
+
|
| 163 |
+
# Paralanguage (instruct model)
|
| 164 |
+
python inference.py \
|
| 165 |
+
--config configs/infer_pilot_tts_instruct.yaml \
|
| 166 |
+
--checkpoint pretrained_models/pilot_tts_instruct.pt \
|
| 167 |
+
--prompt-wav assert/prompt.wav \
|
| 168 |
+
--text "这个笑话太好笑了<|LAUGH|>我真的忍不住" \
|
| 169 |
+
--output output/paralang.wav
|
| 170 |
+
|
| 171 |
+
# Dialect synthesis (instruct model)
|
| 172 |
+
python inference.py \
|
| 173 |
+
--config configs/infer_pilot_tts_instruct.yaml \
|
| 174 |
+
--checkpoint pretrained_models/pilot_tts_instruct.pt \
|
| 175 |
+
--prompt-wav assert/prompt.wav \
|
| 176 |
+
--text "中不中啊,咱俩一块儿去吃胡辣汤吧" \
|
| 177 |
+
--language zh-henan \
|
| 178 |
+
--output output/dialect.wav
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
### Supported Controls
|
| 182 |
+
|
| 183 |
+
| Feature | Usage | Model |
|
| 184 |
+
|---------|-------|-------|
|
| 185 |
+
| Voice Cloning | Provide prompt audio | Both |
|
| 186 |
+
| Emotions | `--emotion <tag>` | Instruct |
|
| 187 |
+
| Paralanguage | Insert tags in text | Instruct |
|
| 188 |
+
| Dialects | `--language <dialect>` | Instruct |
|
| 189 |
+
|
| 190 |
+
**Emotions:**
|
| 191 |
+
|
| 192 |
+
| Tag | 情感 | Tag | 情感 |
|
| 193 |
+
|-----|------|-----|------|
|
| 194 |
+
| `happy` | 开心 | `sad` | 悲伤 |
|
| 195 |
+
| `angry` | 愤怒 | `surprise` | 惊讶 |
|
| 196 |
+
| `fear` | 恐惧 | `disgust` | 厌恶 |
|
| 197 |
+
| `serious` | 严肃 | `concern` | 关切 |
|
| 198 |
+
| `blue` | 忧郁 | `disdain` | 轻蔑 |
|
| 199 |
+
| `neutral` | 中性/平静 | `psychology` | 心理活动 |
|
| 200 |
+
| `unknown` | 不指定情感 | | |
|
| 201 |
+
|
| 202 |
+
**Paralanguage tags:**
|
| 203 |
+
|
| 204 |
+
| Tag | Description |
|
| 205 |
+
|-----|-------------|
|
| 206 |
+
| `<\|LAUGH\|>` | 笑声 |
|
| 207 |
+
| `<\|BREATH\|>` | 呼吸声 |
|
| 208 |
+
| `<\|COUGH\|>` | 咳嗽 |
|
| 209 |
+
| `<\|CRY\|>` | 哭泣声 |
|
| 210 |
+
| `<\|LAUGH_SPAN\|>...<\|/LAUGH_SPAN\|>` | 包裹笑声文本 |
|
| 211 |
+
|
| 212 |
+
**Dialects:**
|
| 213 |
+
|
| 214 |
+
| Tag | 方言 | Tag | 方言 |
|
| 215 |
+
|-----|------|-----|------|
|
| 216 |
+
| `zh-dongbei` | 东北话 | `zh-shandong` | 山东话 |
|
| 217 |
+
| `zh-henan` | 河南话 | `zh-shan1xi` | 山西话 |
|
| 218 |
+
| `zh-minnan` | 闽南语 | `zh-gansu` | 甘肃话 |
|
| 219 |
+
| `zh-ningxia` | 宁夏话 | `zh-shanghai` | 上海话 |
|
| 220 |
+
| `zh-chongqing` | 重庆话 | `zh-hubei` | 湖北话 |
|
| 221 |
+
| `zh-hunan` | 湖南话 | `zh-jiangxi` | 江西话 |
|
| 222 |
+
| `zh-guizhou` | 贵州话 | `zh-yunnan` | 云南话 |
|
| 223 |
+
|
| 224 |
+
## WebUI
|
| 225 |
+
|
| 226 |
+
Launch a Gradio-based interactive interface:
|
| 227 |
+
|
| 228 |
+
```bash
|
| 229 |
+
python webui.py --port 9000
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
## Project Structure
|
| 233 |
+
|
| 234 |
+
```
|
| 235 |
+
pilot-tts/
|
| 236 |
+
├── configs/ # Inference configurations (per checkpoint)
|
| 237 |
+
├── demo.py # Complete demo (all inference modes)
|
| 238 |
+
├── inference.py # CLI inference entry
|
| 239 |
+
├── webui.py # Gradio WebUI
|
| 240 |
+
├── asset/ # Example prompt audio
|
| 241 |
+
├── pilot_voice/ # Core model code
|
| 242 |
+
│ ├── engine.py # InferenceEngine pipeline
|
| 243 |
+
│ ├── model.py # AR model (Qwen3 backbone + audio tokens)
|
| 244 |
+
│ ├── sampling.py # RAS sampling (from VALL-E 2)
|
| 245 |
+
│ ├── utils.py # Utilities
|
| 246 |
+
│ ├── modules/ # Conformer + Perceiver modules
|
| 247 |
+
│ └── tools/ # Audio & text processing
|
| 248 |
+
├── third_party/
|
| 249 |
+
│ ├── cosyvoice/ # Flow-matching vocoder
|
| 250 |
+
│ └── Matcha-TTS/ # Flow matching dependency
|
| 251 |
+
├── tokenizer/ # Custom tokenizer with special tokens
|
| 252 |
+
├── pretrained_models/ # Model weights (not in git)
|
| 253 |
+
└── requirements.txt
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
## Acknowledgements
|
| 257 |
+
|
| 258 |
+
- [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) — Flow-matching & Vocoder
|
| 259 |
+
- [Qwen3](https://github.com/QwenLM/Qwen3) — LLM backbone
|
| 260 |
+
- [Matcha-TTS](https://github.com/shivammehta25/Matcha-TTS) — Flow matching framework
|
| 261 |
+
- [MaskGCT](https://github.com/open-mmlab/Amphion/tree/main/models/tts/maskgct) — wav2vec2bert feature statistics
|
| 262 |
+
|
| 263 |
+
## Citation
|
| 264 |
+
|
| 265 |
+
```bibtex
|
| 266 |
+
@article{pilottts2025,
|
| 267 |
+
title={PilotTTS: A Disciplined Modular Recipe for Competitive Speech Synthesis},
|
| 268 |
+
author={},
|
| 269 |
+
year={2025},
|
| 270 |
+
journal={arXiv preprint arXiv:xxxx.xxxxx}
|
| 271 |
+
}
|
| 272 |
+
```
|
| 273 |
+
|
| 274 |
+
## License
|
| 275 |
+
|
| 276 |
+
Apache-2.0
|
README_zh.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PilotTTS: A Disciplined Modular Recipe for Competitive Speech Synthesis
|
| 2 |
+
|
| 3 |
+
<p align="center">
|
| 4 |
+
<img src="assert/Introduction.png" width="600" />
|
| 5 |
+
</p>
|
| 6 |
+
|
| 7 |
+
<p align="center">
|
| 8 |
+
<a href="README.md">English</a> | 中文
|
| 9 |
+
</p>
|
| 10 |
+
|
| 11 |
+
<p align="center">
|
| 12 |
+
📑 <a href="#">论文</a> | 🤗 <a href="https://huggingface.co/AmapVoice/PilotTTS">HuggingFace</a> | 🤖 <a href="https://www.modelscope.cn/models/AmapVoice/PilotTTS">ModelScope</a> | 🎧 <a href="https://amapvoice.github.io/PilotTTS/">演示样例</a>
|
| 13 |
+
</p>
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
## 最新动态 📝
|
| 19 |
+
|
| 20 |
+
- **[2026.05]** 发布 Pilot-TTS 基础模型和指令模型权重
|
| 21 |
+
|
| 22 |
+
## 亮点 🔥
|
| 23 |
+
**PilotTTS** 是一个基于大语言模型(LLM)的文本到语音(TTS)系统。它采用全开源模型构建极简化架构,并在严格的数据工程实践下实现了具有竞争力的性能。
|
| 24 |
+
### 关键特性:
|
| 25 |
+
- **一个由全开源算子构建的数据处理流水线:** 我们设计了一个多阶段的、涵盖质量评估与增强、标注以及质量过滤能力的、且全部算子都建立在公开可用工具之上的数据处理流水线。该流水线将负责互联网音频转化为干净且富有标注信息的训练数据,在显著降低成本的同时实现高质量数据产出。
|
| 26 |
+
- **内容一致性与说话人相似度情感控制:** 我们的模型在 Seed-TTS 测试集上,获得了极高的说话人相似度(0.862)以及极具竞争力的内容准确性(CER 0.87%),达到业界领先水平。
|
| 27 |
+
- **情感和副语言控制:** 支持11 类情感(Happy、Sad、Fear、Angry、Contempt、Serious、Surprise、Blue、Concern、Disgust、Psychology)的控制合成以及4类副语言(LAUGH、BREATH、CRY、COUGH)控制合成。
|
| 28 |
+
- **方言合成:** 支持14种中文方言,并且支持跨方言合成,尤其擅长中文普通话到目标方言的合成。
|
| 29 |
+
|
| 30 |
+
## 安装 ⚙️
|
| 31 |
+
|
| 32 |
+
### 克隆仓库
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
git clone https://github.com/xxx/pilot-tts.git
|
| 36 |
+
cd pilot-tts
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### 环境配置
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
conda create -n pilot-tts python=3.10 -y
|
| 43 |
+
conda activate pilot-tts
|
| 44 |
+
pip install -r requirements.txt
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### 模型下载
|
| 48 |
+
|
| 49 |
+
#### 1. Pilot-TTS 模型(我们的权重)
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
# ModelScope
|
| 53 |
+
from modelscope import snapshot_download
|
| 54 |
+
snapshot_download('xxx/Pilot-TTS', local_dir='pretrained_models/')
|
| 55 |
+
|
| 56 |
+
# HuggingFace
|
| 57 |
+
from huggingface_hub import snapshot_download
|
| 58 |
+
snapshot_download('xxx/Pilot-TTS', local_dir='pretrained_models/')
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
包含:`pilot_tts.pt`、`pilot_tts_instruct.pt` 和 `tokenizer/`。
|
| 62 |
+
|
| 63 |
+
#### 2. 第三方开源模型
|
| 64 |
+
|
| 65 |
+
从各自的开源项目下载以下依赖:
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from modelscope import snapshot_download
|
| 69 |
+
|
| 70 |
+
# Qwen3-0.6B(LLM 骨干网络)
|
| 71 |
+
snapshot_download('Qwen/Qwen3-0.6B', local_dir='pretrained_models/Qwen3-0.6B')
|
| 72 |
+
|
| 73 |
+
# CosyVoice3(flow-matching 声码器,包含 campplus.onnx)
|
| 74 |
+
snapshot_download('FunAudioLLM/Fun-CosyVoice3-0.5B-2512', local_dir='pretrained_models/CosyVoice3-0.5B')
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from huggingface_hub import snapshot_download
|
| 79 |
+
|
| 80 |
+
# w2v-bert-2.0(音频特征提取器)
|
| 81 |
+
snapshot_download('facebook/w2v-bert-2.0', local_dir='pretrained_models/w2v-bert-2.0')
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
> 注:`wav2vec2bert_stats.pt`(来自 [MaskGCT](https://github.com/open-mmlab/Amphion/tree/main/models/tts/maskgct))已包含在 Pilot-TTS 模型包中。
|
| 85 |
+
|
| 86 |
+
#### 最终目录结构
|
| 87 |
+
|
| 88 |
+
```
|
| 89 |
+
pretrained_models/
|
| 90 |
+
├── pilot_tts.pt # 基础模型(零样本声音克隆)
|
| 91 |
+
├── pilot_tts_instruct.pt # 指令模型(情感、副语言、方言)
|
| 92 |
+
├── Qwen3-0.6B/ # LLM 骨干网络(来自 Qwen)
|
| 93 |
+
├── w2v-bert-2.0/ # 音频特征提取器(来自 Meta)
|
| 94 |
+
├── wav2vec2bert_stats.pt # 特征归一化统计(来自 MaskGCT)
|
| 95 |
+
└── CosyVoice3-0.5B/ # Flow-matching 声码器(来自 FunAudioLLM)
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
## 快速开始 📖
|
| 99 |
+
|
| 100 |
+
一键运行所有推理示例:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
python demo.py
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## 推理
|
| 107 |
+
|
| 108 |
+
### Python API
|
| 109 |
+
|
| 110 |
+
```python
|
| 111 |
+
from demo import load_engine, synthesize
|
| 112 |
+
|
| 113 |
+
# 零样本声音克隆(基础模型)
|
| 114 |
+
engine = load_engine(
|
| 115 |
+
config_path="configs/infer_pilot_tts.yaml",
|
| 116 |
+
checkpoint="pretrained_models/pilot_tts.pt",
|
| 117 |
+
)
|
| 118 |
+
synthesize(engine, text="你好,世界!",
|
| 119 |
+
prompt_wav="assert/prompt.wav",
|
| 120 |
+
output_path="output/clone.wav")
|
| 121 |
+
|
| 122 |
+
# 加载指令模型(情感、副语言、方言)
|
| 123 |
+
engine_instruct = load_engine(
|
| 124 |
+
config_path="configs/infer_pilot_tts_instruct.yaml",
|
| 125 |
+
checkpoint="pretrained_models/pilot_tts_instruct.pt",
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
# 情感合成
|
| 129 |
+
synthesize(engine_instruct, text="今天天气真好啊!",
|
| 130 |
+
prompt_wav="assert/prompt.wav",
|
| 131 |
+
emotion="happy", output_path="output/happy.wav")
|
| 132 |
+
|
| 133 |
+
# 副语言
|
| 134 |
+
synthesize(engine_instruct, text="这太好笑了<|LAUGH|>停不下来",
|
| 135 |
+
prompt_wav="assert/prompt.wav",
|
| 136 |
+
output_path="output/laugh.wav")
|
| 137 |
+
|
| 138 |
+
# 方言(河南话)
|
| 139 |
+
synthesize(engine_instruct, text="中不中啊,咱俩一块儿去吃胡辣汤吧",
|
| 140 |
+
prompt_wav="assert/prompt.wav",
|
| 141 |
+
language="zh-henan", output_path="output/henan.wav")
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
### 命令行
|
| 145 |
+
|
| 146 |
+
```bash
|
| 147 |
+
# 零样本声音克隆(基础模型)
|
| 148 |
+
python inference.py \
|
| 149 |
+
--checkpoint pretrained_models/pilot_tts.pt \
|
| 150 |
+
--prompt-wav assert/prompt.wav \
|
| 151 |
+
--text "需要合成的目标文本" \
|
| 152 |
+
--output output/zeroshot.wav
|
| 153 |
+
|
| 154 |
+
# 情感合成(指令模型)
|
| 155 |
+
python inference.py \
|
| 156 |
+
--config configs/infer_pilot_tts_instruct.yaml \
|
| 157 |
+
--checkpoint pretrained_models/pilot_tts_instruct.pt \
|
| 158 |
+
--prompt-wav assert/prompt.wav \
|
| 159 |
+
--text "今天天气真好啊,我们去公园玩吧!" \
|
| 160 |
+
--emotion happy \
|
| 161 |
+
--output output/emotion.wav
|
| 162 |
+
|
| 163 |
+
# 副语言(指令模型)
|
| 164 |
+
python inference.py \
|
| 165 |
+
--config configs/infer_pilot_tts_instruct.yaml \
|
| 166 |
+
--checkpoint pretrained_models/pilot_tts_instruct.pt \
|
| 167 |
+
--prompt-wav assert/prompt.wav \
|
| 168 |
+
--text "这个笑话太好笑了<|LAUGH|>我真的忍不住" \
|
| 169 |
+
--output output/paralang.wav
|
| 170 |
+
|
| 171 |
+
# 方言合成(指令模型)
|
| 172 |
+
python inference.py \
|
| 173 |
+
--config configs/infer_pilot_tts_instruct.yaml \
|
| 174 |
+
--checkpoint pretrained_models/pilot_tts_instruct.pt \
|
| 175 |
+
--prompt-wav assert/prompt.wav \
|
| 176 |
+
--text "中不中啊,咱俩一块儿去吃胡辣汤吧" \
|
| 177 |
+
--language zh-henan \
|
| 178 |
+
--output output/dialect.wav
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
### 支持的控制功能
|
| 182 |
+
|
| 183 |
+
| 功能 | 用法 | 所需模型 |
|
| 184 |
+
|------|------|----------|
|
| 185 |
+
| 声音克隆 | 提供参考音频 | 两者均可 |
|
| 186 |
+
| 情感 | `--emotion <标签>` | 指令模型 |
|
| 187 |
+
| 副语言 | 在文本中插入标签 | 指令模型 |
|
| 188 |
+
| 方言 | `--language <方言>` | 指令模型 |
|
| 189 |
+
|
| 190 |
+
**情感标签:**
|
| 191 |
+
|
| 192 |
+
| 标签 | 情感 | 标签 | 情感 |
|
| 193 |
+
|------|------|------|------|
|
| 194 |
+
| `happy` | 开心 | `sad` | 悲伤 |
|
| 195 |
+
| `angry` | 愤怒 | `surprise` | 惊讶 |
|
| 196 |
+
| `fear` | 恐惧 | `disgust` | 厌恶 |
|
| 197 |
+
| `serious` | 严肃 | `concern` | 关切 |
|
| 198 |
+
| `blue` | 忧郁 | `disdain` | 轻蔑 |
|
| 199 |
+
| `neutral` | 中性/平静 | `psychology` | 心理活动 |
|
| 200 |
+
| `unknown` | 不指定情感 | | |
|
| 201 |
+
|
| 202 |
+
**副语言标签:**
|
| 203 |
+
|
| 204 |
+
| 标签 | 说明 |
|
| 205 |
+
|------|------|
|
| 206 |
+
| `<\|LAUGH\|>` | 笑声 |
|
| 207 |
+
| `<\|BREATH\|>` | 呼吸声 |
|
| 208 |
+
| `<\|COUGH\|>` | 咳嗽 |
|
| 209 |
+
| `<\|CRY\|>` | 哭泣声 |
|
| 210 |
+
| `<\|LAUGH_SPAN\|>...<\|/LAUGH_SPAN\|>` | 包裹笑声文本 |
|
| 211 |
+
|
| 212 |
+
**方言标签:**
|
| 213 |
+
|
| 214 |
+
| 标签 | 方言 | 标签 | 方言 |
|
| 215 |
+
|------|------|------|------|
|
| 216 |
+
| `zh-dongbei` | 东北话 | `zh-shandong` | 山东话 |
|
| 217 |
+
| `zh-henan` | 河南话 | `zh-shan1xi` | 山西话 |
|
| 218 |
+
| `zh-minnan` | 闽南语 | `zh-gansu` | 甘肃话 |
|
| 219 |
+
| `zh-ningxia` | 宁夏话 | `zh-shanghai` | 上海话 |
|
| 220 |
+
| `zh-chongqing` | 重庆话 | `zh-hubei` | 湖北话 |
|
| 221 |
+
| `zh-hunan` | 湖南话 | `zh-jiangxi` | 江西话 |
|
| 222 |
+
| `zh-guizhou` | 贵州话 | `zh-yunnan` | 云南话 |
|
| 223 |
+
|
| 224 |
+
## WebUI
|
| 225 |
+
|
| 226 |
+
启动基于 Gradio 的交互式界面:
|
| 227 |
+
|
| 228 |
+
```bash
|
| 229 |
+
python webui.py --port 9000
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
## 项目结构
|
| 233 |
+
|
| 234 |
+
```
|
| 235 |
+
pilot-tts/
|
| 236 |
+
├── configs/ # 推理配置(按 checkpoint 区分)
|
| 237 |
+
├── demo.py # 完整示例(全部推理模式)
|
| 238 |
+
├── inference.py # 命令行推理入口
|
| 239 |
+
├── webui.py # Gradio WebUI
|
| 240 |
+
├── asset/ # 示例参考音频
|
| 241 |
+
├── pilot_voice/ # 核心模型代码
|
| 242 |
+
│ ├── engine.py # InferenceEngine 推理流水线
|
| 243 |
+
│ ├── model.py # AR 模型(Qwen3 骨干 + 音频 token)
|
| 244 |
+
│ ├── sampling.py # RAS 采样(源自 VALL-E 2)
|
| 245 |
+
│ ├── utils.py # 工具函数
|
| 246 |
+
│ ├── modules/ # Conformer + Perceiver 模块
|
| 247 |
+
│ └── tools/ # 音频与文本处理工具
|
| 248 |
+
├── third_party/
|
| 249 |
+
│ ├── cosyvoice/ # Flow-matching 声码器
|
| 250 |
+
│ └── Matcha-TTS/ # Flow matching 依赖
|
| 251 |
+
├── tokenizer/ # 含特殊 token 的自定义分词器
|
| 252 |
+
├── pretrained_models/ # 模型权重(不在 git 中)
|
| 253 |
+
└── requirements.txt
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
## 致谢
|
| 257 |
+
|
| 258 |
+
- [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) — Flow-matching 与声码器
|
| 259 |
+
- [Qwen3](https://github.com/QwenLM/Qwen3) — LLM 骨干网络
|
| 260 |
+
- [Matcha-TTS](https://github.com/shivammehta25/Matcha-TTS) — Flow matching 框架
|
| 261 |
+
- [MaskGCT](https://github.com/open-mmlab/Amphion/tree/main/models/tts/maskgct) — wav2vec2bert 特征统计
|
| 262 |
+
|
| 263 |
+
## 许可证
|
| 264 |
+
|
| 265 |
+
Apache-2.0
|
| 266 |
+
|
pilot_tts.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1c3382023646574949d47ed27046229a798e5d510d6f37690ad6e7001aa19c57
|
| 3 |
+
size 1599924318
|
pilot_tts_instruct.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6ed57f0ff19bc3ef2b152d52ad54fba256b94b11ed9e37f5fb200ac62855d035
|
| 3 |
+
size 1599822744
|
wav2vec2bert_stats.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9c176c2b8850ab2e3ba828bbfa969deaf4566ce55db5f2687b8430b87526ad2
|
| 3 |
+
size 9343
|