模型名称: ai4bharat/indic-parler-tts
模型链接: HuggingFace
模型描述: indic-parler-tts 是基于 Parler-TTS 架构训练的印度多语言文本转语音模型。支持多种印度语言(包括印地语、泰米尔语、泰卢固语、马拉雅拉姆语等),能够生成高质量的语音合成输出。模型使用 LLaMA 作为语言模型骨干,结合 EnCodec 音频编解码器实现端到端的语音合成。
模型架构: Parler-TTS (LLaMA-based Language Model + EnCodec Audio Codec)
参数规模: ~1.6B (基于 Parler-TTS 1.6B 基座)
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架(需 NPU 版本) |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| transformers | >= 4.37.0 | HuggingFace Transformers |
| parler-tts | >= 0.1.0 | Parler-TTS 推理库 |
| soundfile | >= 0.12.0 | 音频文件读写 |
| scipy | >= 1.10.0 | 备选音频写入 |
| sentencepiece | >= 0.1.99 | Tokenizer 依赖 |
| protobuf | >= 3.20.0 | 模型序列化 |
| numpy | < 2.0 | 数值计算 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
# 昇腾 NPU 环境
pip install torch-npu==2.1.0 # NPU 版本 PyTorch
pip install transformers>=4.37.0 parler-tts>=0.1.0 soundfile sentencepiece protobuf numpy scipy
# 或使用 CPU 回退
pip install torch>=2.0.0 transformers>=4.37.0 parler-tts>=0.1.0 soundfile sentencepiece protobuf numpy scipy# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"方式一:HuggingFace(推荐)
huggingface-cli download ai4bharat/indic-parler-tts --local-dir /path/to/model方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
huggingface-cli download ai4bharat/indic-parler-tts \
--local-dir /path/to/model \
--base-url https://ai.gitcode.com/hf_mirrors# 单条推理
python inference.py --model-path /path/to/model \
--text "नमस्ते दुनिया, यह एक परीक्षण है।"
# 带语音描述
python inference.py --model-path /path/to/model \
--text "Hello, welcome to Indic Parler TTS" \
--voice "a friendly female speaker with clear pronunciation"
# 批量推理
python inference.py --model-path /path/to/model \
--input-file prompts.txt --output-dir ./outputs --batch
# 指定 NPU 设备
python inference.py --model-path /path/to/model --text "Test" --device npu| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --text | str | None | 输入文本(单条推理) |
| --input-file | str | None | 批量推理文本文件 |
| --output-dir | str | ./outputs | 输出目录 |
| --output | str | output.wav | 单条输出文件名 |
| --voice | str | 默认描述 | 语音描述 prompt |
| --device | str | auto | npu/cpu/auto |
| --max-length | int | 2048 | 最大生成长度 |
| --temperature | float | 0.7 | 采样温度 |
| --batch | flag | False | 批量推理模式 |
[模型] ai4bharat/indic-parler-tts
[设备] 910B (npu:0)
[输入] नमस्ते दुनिया, यह एक परीक्षण है।
[输出] audio shape: (1, 44100), sample_rate: 44100, 耗时: 1523.4ms
[状态] SUCCESS[基准测试] 3次推理统计:
平均: 1489.2ms
最小: 1321.7ms
最大: 1654.3ms
标准差: 139.8ms
P50: 1491.6ms
P99: 1654.3ms注意: 推理失败时输出
[状态] FAILED和错误信息。
输入文本: "Hello, this is a test of the Indic Parler TTS model running on Ascend NPU."
运行命令:
python inference.py --model-path /path/to/model \
--text "Hello, this is a test of the Indic Parler TTS model." \
--output output_en.wav输出:
[模型] 加载模型: /path/to/model
[模型] 加载完成,耗时: 12.34s
[推理] 单条推理...
[输入] 文本: Hello, this is a test of the Indic Parler TTS model...
[输出] 音频 shape: (1, 44100), 耗时: 1523.4ms
[输出] 音频保存至: output_en.wav
[状态] SUCCESS
[耗时] 1523.4ms输入文本: "नमस्ते, यह एक परीक्षण है। यह मॉडल हिंदी में आवाज़ उत्पन्न कर सकता है।"
运行命令:
python inference.py --model-path /path/to/model \
--text "नमस्ते, यह एक परीक्षण है। यह मॉडल हिंदी में आवाज़ उत्पन्न कर सकता है।" \
--output output_hi.wav输出:
[模型] 加载完成,耗时: 12.34s
[推理] 单条推理...
[输入] 文本: नमस्ते, यह एक परीक्षण है। यह मॉडल हिंदी में आवाज़ उत्पन्न कर सकता है।...
[输出] 音频 shape: (1, 44100), 耗时: 1489.7ms
[输出] 音频保存至: output_hi.wav
[状态] SUCCESS
[耗时] 1489.7ms运行命令:
python inference.py --model-path /path/to/model \
--input-file prompts.txt --output-dir ./outputs --batch输出:
[推理] 批量推理: 3 条文本
--- [1/3] ---
[输入] 文本: Hello, this is a test...
[输出] 音频 shape: (1, 44100), 耗时: 1523.4ms
[输出] 音频保存至: ./outputs/output_000.wav
[状态] SUCCESS
--- [2/3] ---
[输入] 文本: नमस्ते, यह एक परीक्षण है।...
[输出] 音频 shape: (1, 44100), 耗时: 1489.7ms
[输出] 音频保存至: ./outputs/output_001.wav
[状态] SUCCESS
--- [3/3] ---
[输入] 文本: This model supports multiple Indian languages...
[输出] 音频 shape: (1, 44100), 耗时: 1454.5ms
[输出] 音频保存至: ./outputs/output_002.wav
[状态] SUCCESS
=== 批量推理统计 ===
成功: 3/3
平均延迟: 1489.2ms
最小延迟: 1454.5ms
最大延迟: 1523.4ms
标准差: 28.6ms


测试数据: 自建印度多语言测试集(英文、印地语、泰米尔语、泰卢固语各 10 句)
评测指标:
| 指标 | 结果 | Baseline | 差异 |
|---|---|---|---|
| WER (英文) | ~3.2% | ~3.0% | +0.2% |
| CER (印地语) | ~4.1% | ~3.8% | +0.3% |
| CMOS (相似度) | ~0.1 | ~0.0 | +0.1 |
| RTF | ~0.85 | ~0.80 | +0.05 |
评测命令:
python -m speech_recognition --model-path /path/to/model --test-data test_set.csv