---
library_name: axera
pipeline_tag: text-to-speech
base_model: ASLP-lab/M5-TTS-50M-VoiceClone
language:
- zh
- en
- de
- fr
- ja
- ko
tags:
- axera
- ax650
- npu
- text-to-speech
- voice-cloning
- zero-shot
- m5-tts
- python
- cpp
---
# M5-TTS.AXERA
### 50M 参数 · 实时流式 · 六语言 + 方言 · zero-shot 音色克隆
     [](https://github.com/ZY-2012/M5-TTS.AXERA)
| 项目 | 说明 |
|---|---|
| **支持语言** | **中文、英语、德语、法语、日语、韩语**(中/英已上板验证) |
| **推理方式** | C++ / Python,6 个 axmodel(NPU)+ int8 host 表,流式(0.64 s 一包)+ 非流式 |
| **首包时延** | TTFA **0.41 s**、首帧 TTFT 0.07 s(参考音色缓存命中) |
| **实时率** | RTF **0.55–0.66**(C++,3–9 s 句)· 0.85–0.98(Python,缓存命中–首次) |
| **模型体积** | **443 MB**(axmodels 284 MB + int8/fp16 host 表 159 MB) |
- HuggingFace: https://huggingface.co/HY-2012/M5-TTS.AXERA
- GitHub(源码 + 转换脚本 + C++): https://github.com/ZY-2012/M5-TTS.AXERA
- 原始模型: https://huggingface.co/ASLP-lab/M5-TTS-50M-VoiceClone
- 语音 codec: https://huggingface.co/ASLP-lab/M5-TTS-Audio-Tokenizer
- 旧版(fp32,899 MB,RTF 0.48–0.58):[`v1-fp32` 分支](https://huggingface.co/HY-2012/M5-TTS.AXERA/tree/v1-fp32)
## 目录
- [模型转换](#convert)
- [支持平台](#platform)
- [上板部署](#deploy)
- [快速开始](#quickstart)
- [结果](#results)
- [推理速度](#speed)
- [参考](#refs)
## 模型转换
For those who are interested in model conversion, you can try to export axmodel through:
- [The repo of AXera Platform](https://github.com/AXERA-TECH), where you can get the detailed guide.
- [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)
完整转换脚本(ONNX 导出 / 真实语音校准 / Pulsar2 配置):[ZY-2012/M5-TTS.AXERA/model_convert](https://github.com/ZY-2012/M5-TTS.AXERA/tree/main/model_convert)
## 支持平台
- AX650N / AX8850
- [M4N-Dock(爱芯派 Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
- [AI Pyramid](https://docs.m5stack.com/zh_CN/ai_hardware/AI_Pyramid-Pro)
- [M.2 Accelerator Card](https://docs.m5stack.com/zh_CN/ai_hardware/LLM-8850_Card)
## 上板部署
- 以 root 权限登陆 AX650N 板卡设备
- 已验证设备:AX650N DEMO Board
### 目录结构
```text
M5-TTS.AXERA/
├── bin/m5tts_ax650 # C++ 推理可执行文件
├── models/
│ ├── *.axmodel # 6 个子图
│ └── assets/ # embedding / heads / RVQ / tokenizer
├── python/
│ ├── m5_ax/ # numpy-only SDK
│ └── demo.py
├── samples/
│ ├── aslp_default_voice.wav
│ └── listen/*.wav # 板端样例(stream/ 为流式输出)
├── config.json
├── run_ax650.sh # 一键脚本(默认 C++,--python 切 SDK)
└── setup.sh
```
## 快速开始(AX650 板端)
下载整仓库到板端,在包根目录运行:
```bash
bash setup.sh
# C++(默认,最快)
bash run_ax650.sh "你好,欢迎使用我们的语音合成模型。" samples/aslp_default_voice.wav \
"猪携带该疾病,然后通过蚊子传染给人类。" out.wav
# 流式输出
bash run_ax650.sh "你好,欢迎使用我们的语音合成模型。" samples/aslp_default_voice.wav \
"猪携带该疾病,然后通过蚊子传染给人类。" out.wav --stream
# Python SDK(流式 / 非流式)
bash run_ax650.sh "The voice generated by this model sounds amazing!" samples/aslp_default_voice.wav \
"猪携带该疾病,然后通过蚊子传染给人类。" en.wav --python --stream
# 调随机种子 / 最长帧数(1 帧 ≈ 80 ms)
bash run_ax650.sh "Hello from AX650!" samples/aslp_default_voice.wav "参考音频转写" en.wav --seed 42 --max-frames 200
```
参考音频 ≤ 4.8 s;单次生成 ≤ 20 s 音频;`prompt-text` 必须是参考音频的准确转写。
C++ 会缓存参考音色(`cache/ref`),同一音色重复使用时首包时延 0.43 → 0.07 s;Python 会缓存到 `cache/py_ref`(首次运行编码参考音频)。
## 结果
| 用例 | 文本 | 参考音色 | 音频 | 非流式 | 流式 |
|---|---|---|---|---|---|
| zh_default | 你好,欢迎使用我们的语音合成模型。 | | 3.52 s | | |
| en_default | The voice generated by this model sounds amazing! | | 3.60 s | | |
| zh_long | 今天天气很好,我们一起去公园散步吧。公园里有很多花… | | 8.72 s | | |
> 全部样例由 AX650 板端生成;流式与非流式输出逐样本一致,板端 SenseVoice 转写与输入文本一致。
> host 表为 int8(每行 scale)+ codec 编码码本 fp16,加载时反量化;codec RVQ 解码在 axmodel 内完成。
## 推理速度
| 模式 | 实现 | 音频 | TTFT(首帧) | TTFA(首音频) | 总耗时 | RTF(耗时/音频) | 出包间隔 |
|---|---|---|---|---|---|---|---|
| **流式** | C++ | 3.52 s | 0.07–0.41 s | **0.41–0.76 s** | 1.96–2.33 s | **0.55–0.66** | 0.64 s(首包 0.40 s) |
| **流式** | Python | 3.04 s | 0.17–0.40 s | 0.67–1.05 s | 2.57–2.97 s | 0.85–0.98 | 0.64 s(首包 0.72 s) |
| 非流式 | C++ | 3.52 s | 0.07–0.43 s | — | 2.08–2.35 s | 0.59–0.66 | — |
| 非流式 | Python | 3.04 s | 0.17–0.40 s | — | 2.57–2.97 s | 0.85–0.98 | — |
> 区间为“同一参考音色:缓存命中 – 首次”。C++ 长句(8.72 s,缓存):TTFA 0.41 s、总耗时 4.77 s、RTF 0.55。
## 参考
- 原始模型:https://huggingface.co/ASLP-lab/M5-TTS-50M-VoiceClone
- M5-TTS 代码 / 技术报告:https://github.com/ASLP-lab/M5-TTS
- Qwen3-TTS codec:https://github.com/QwenLM/Qwen3-TTS
- Pulsar2 文档:https://pulsar2-docs.readthedocs.io
## License
Apache-2.0。上游 M5-TTS(ASLP-lab)与 Qwen3-TTS codec 遵循其各自许可证,见 `NOTICE`。