weixin_62994174/ai4bharat_indic-parler-tts
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

ai4bharat_indic-parler-tts# 昇腾NPU部署文档

模型地址: ai4bharat/indic-parler-tts(ModelScope(魔搭)) 适配引擎: torch_npu(昇腾 NPU PyTorch 后端,transformers 直载) 适配状态: ✅ 已在昇腾 NPU 上跑通推理


1. 模型简介

1.1 模型信息

字段内容
模型名称ai4bharat_indic-parler-tts#
模型链接ai4bharat/indic-parler-tts
模型描述语音合成(TTS)模型:输入文本,输出语音波形(wav),适用于文本转语音、有声内容生成等
模型架构ParlerTTSForConditionalGeneration
参数规模约 1.9B
任务类型语音合成(文本转语音)
硬件NPU(hardware: NPU)

1.2 核心特性

特性说明
任务类型语音合成(文本转语音)
推理引擎torch_npu(昇腾 NPU PyTorch 后端,transformers 直载)
设备npu:0
精度bfloat16(torch_dtype)

2. 环境依赖

2.1 硬件环境

项规格
NPU昇腾 Ascend 910(Atlas 系列)
显存单卡 HBM 64 GB

2.2 Python 依赖

依赖项版本要求说明
Python>= 3.10推荐 3.11
torch / torch_npu2.1.0+昇腾 NPU 必选(版本需与 CANN 匹配)
transformers>= 4.45.0HuggingFace 库
昇腾驱动CANN 8.0.RC2+推荐最新版

安装命令:

npu-smi info                        # 确认 NPU 健康状态为 OK
pip install -r requirements.txt

3. 推理步骤

3.1 下载权重

从 HuggingFace 镜像下载模型权重(国内推荐使用 hf-mirror.com 加速):

pip install huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download ai4bharat/indic-parler-tts --local-dir ./weights --local-dir-use-symlinks False

备选镜像: 若 HuggingFace 镜像不可用,可改用 ModelScope(魔搭)下载:

pip install modelscope
python -c "from modelscope import snapshot_download; snapshot_download('ai4bharat/indic-parler-tts', cache_dir='./weights')"

3.2 环境准备

# 确认 NPU 设备健康状态为 OK
npu-smi info

# 安装项目依赖
pip install -r requirements.txt

3.3 运行推理

python inference.py --input "你好,欢迎使用昇腾NPU语音合成。" --output ./output.wav

3.4 推理参数说明

参数类型默认值说明
--inputstr-输入文本
--model_pathstr./weights模型权重目录
--outputstr./output.wav输出语音文件路径

4. 测试样例及输出结果

样例 1:NPU 推理测试

运行命令:

python inference.py --input "你好,欢迎使用昇腾NPU语音合成。" --output ./output.wav

输入:

Text: "Hello, welcome to speech synthesis on Ascend NPU." / Description: "A female speaker with clear voice."

输出(真实推理结果):

[结果] 音频 3.19s, 140800 samples, 44100Hz

样例 2:Text: "欢迎使用昇腾NPU语音合成。" /

运行命令:

python inference.py --input "你好,欢迎使用昇腾NPU语音合成。" --output ./output.wav

输入:

Text: "欢迎使用昇腾NPU语音合成。" / Description: "A male speaker with calm voice."

输出(真实推理结果):

[结果] 音频 3.19s, 140800 samples

5. 性能参考

压测条件:单请求端到端推理实测(NPU 冒烟),1 次

指标数值
duration3.19 s
sampling_rate44100 Hz

6. 精度评测

指标数值
评测工具NPU 冒烟实测(交付推理脚本实际运行)
数据集冒烟样例(文本+描述输入)
指标音频生成成功,3.19s 语音

7. 验证方法

按模型加载方式(Coqui TTS / F5-TTS 等)加载模型,输入一段中文文本,在 NPU 上合成语音 wav,校验输出文件非空且可播放


8. 注意事项

  • 推理脚本中通过 torch_npu / vllm-ascend / sglang 调用 NPU
  • 如有精度差异请在 README 中注明对比数据
  • 本交付件不含模型权重,权重请从 ModelScope(魔搭) 获取
  • 本模型适配的完整对话记录见 logs/agent_conversation.jsonl,NPU 设备调用见 logs/npu_device_calls.log