m0_74196153/MegaTTS3
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

MegaTTS3 on Ascend NPU

1. 简介

本文档记录 ByteDance/MegaTTS3 在 Ascend NPU 环境的适配与验证结果。

MegaTTS3 是字节跳动提出的零样本语音合成模型,采用 Sparse Alignment Enhanced Latent Diffusion Transformer 架构。模型总参数量约 0.78B,包含:

组件参数量说明
Diffusion Transformer (DiT)459M24层, 1024维, 16头
WaveVAE (Decoder)256M仅解码器模式
AR Duration Predictor67M自回归时长预测
Aligner (Whisper-based)53M音素对齐
G2P (Qwen2.5-0.5B)0.5B字素-音素转换

相关获取地址:

  • 权重下载地址(HuggingFace):https://huggingface.co/ByteDance/MegaTTS3
  • 原始代码仓库:https://github.com/bytedance/MegaTTS3
  • 论文:https://arxiv.org/abs/2502.18924

2. NPU 适配改动

文件改动内容
tts/infer_cli.py设备检测 NPU 支持, autocast 泛化
tts/frontend_function.py4 处 autocast 调用适配
tts/gradio_api.pyNPU 设备检测
tts/utils/audio_utils/io.pysoundfile 回退
tts/text_norm_fix.pypynini 回退文本正则化(新增)

3. 验证环境

组件版本
torch2.9.0+cpu
torch-npu2.9.0.post1
CANN8.5.1
NPUAscend910B4

4. 性能参考

测试条件:Ascend910B4 NPU,float16 精度。

测试场景语言扩散步数预处理(s)推理(s)输出大小显存占用
zh_short中文83.643.38177 KB6.14 GB
zh_short中文163.643.70181 KB6.14 GB
en_short英文82.753.90230 KB6.14 GB
en_short英文162.754.20234 KB6.14 GB

注:首次推理含 NPU 图编译开销(约 30s),后续推理稳定在 3-5s。

5. 快速推理

python tts/infer_cli.py \
    --input_wav 'assets/Chinese_prompt.wav' \
    --input_text "你好世界,欢迎使用人工智能语音合成系统。" \
    --output_dir ./gen

6. 注意事项

  1. 首次推理较慢:NPU 首次推理包含图编译/缓存过程,后续推理显著加快。
  2. pynini 兼容性:aarch64 Linux 上 OpenFST 编译困难,已内置回退文本正则化方案。
  3. ffprobe 依赖:pydub 需要 ffprobe,已增加 soundfile 作为优先降级方案。
  4. WaveVAE Decoder-Only:当前检查点仅包含解码器,需要使用预提取的 .npy latent 文件。