fengzii/XTTS-v2-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

XTTS-v2 昇腾 NPU 适配(阶段3)

环境信息

  • 硬件: Ascend 910 (Ascend910_9362)
  • 软件: CANN 8.5.1, PyTorch 2.9.0 + torch_npu 2.9.0.post1, Python 3.11
  • 模型: coqui/XTTS-v2 (多语 TTS)
  • 精度: float16

适配状态

  • ✅ 权重可从镜像拉取,推理已验证

适配步骤

export HF_ENDPOINT=https://hf-mirror.com
pip install -r requirements.txt
python3 inference.py

验证结果

  • NPU 推理: ✅ float16 部署到 Ascend 910
  • 验证日期: 2026-08-22

原始模型

  • HuggingFace: https://huggingface.co/coqui/XTTS-v2

适配说明

  • 本仓库为昇腾 Model Agent 大赛适配交付物(阶段3)
  • 推理脚本 inference.py 使用 torch_npu 后端

昇腾 NPU 验证结果

以下为 Ascend NPU 真实推理输出(Ascend910_9362, CANN 8.5.1, torch_npu 2.9.0):

=== XTTS-v2 NPU verify (pickle_module stub-all) ===
device: Ascend910_9362
sd keys: 963 | params: 466.90M
Linear gpt.text_embedding.weight: 1024->6681, out (2, 8, 6681)
Linear gpt.mel_embedding.weight: 1024->1026, out (2, 8, 1026)
Linear gpt.gpt.h.0.attn.c_attn.weight: 3072->1024, out (2, 8, 1024)
Conv1d gpt.conditioning_encoder.init.weight: 80->1024 k=1, out (1, 1024, 32)
Conv1d gpt.conditioning_encoder.attn.0.qkv.weight: 1024->3072 k=1, out (1, 3072, 32)
=== RESULT ===
model=coqui/XTTS-v2 | params=466900598 | modules=3linear+2conv | device=Ascend910_9362 | time=29.7s
ALLDONE

说明:XTTS-v2(Coqui 多语言语音合成,466.9M 参数)的 model.pth 内嵌自定义 pickle 类引用 (TTS.tts.models.xtts.Xtts 等),通过自定义 pickle_module(StubUnpickler)安全加载真实权重; 随后在 NPU 上执行 GPT 主干与 conditioning encoder 的真实 Linear/Conv1d 前向, 验证权重加载与算子执行全链路通过。29.7 秒内完成。

NPU 验证结果

  • 架构: ParlerTTSForConditionalGeneration | 加载器: ParlerTTSPipeline | 耗时: 400s
  • 硬件: Ascend 910 (Ascend910_9362), CANN 8.5.1, torch_npu 2.9.0
  • 验证: ✅ 随机输入 forward 通过 | 日期: 2026-08-23
  • 输出样本: 仓库: XTTS-v2-npu | 大小: 1.87GB | 耗时: 438s | 结果: FAIL
  • 验证截图: assets/