原项目 https://modelscope.cn/studios/javahui/index-tts2-test/files
该项目在 index-tts 的基础上使用 vllm 库重新实现了 gpt 模型的推理,加速了 index-tts 的推理过程。
重写了 api_server.py 接口。各种接口作用可以通过/docs查看。
添加了生成语音转字幕的功能。
这是作者的效果 推理速度在单卡 RTX 4090 上的提升为:
- 单个请求的 RTF (Real-Time Factor):≈0.3 -> ≈0.1
- 单个请求的 gpt 模型 decode 速度:≈90 token / s -> ≈280 token / s
- 并发量:gpu_memory_utilization设置为0.25(约5GB显存)的情况下,实测 16 左右的> 并发无压力(测速脚本参考
simple_test.py)
我测试的是1.5版本在L40上gpu_memory_utilization设置为0.1,并发量16,80个任务有一个生成失败。想要用至少又9G的空余显存空间
现在只有indextts1.5的模型文件。如果有需求,可以自行下载其他版本的模型文件。
# Index-TTS
modelscope download --model kusuriuri/Index-TTS-vLLM --local_dir ./checkpoints/Index-TTS-vLLM
# IndexTTS-1.5
modelscope download --model kusuriuri/Index-TTS-1.5-vLLM --local_dir ./checkpoints/Index-TTS-1.5-vLLM
# IndexTTS-2
modelscope download --model kusuriuri/IndexTTS-2-vLLM --local_dir ./checkpoints/IndexTTS-2-vLLM
使用 fastapi 封装了 api 接口,启动示例如下,请将 --model_dir 改为你的模型的实际路径:默认使用Index-TTS-v1.5
python api_server.py --model_dir /your/path/to/Index-TTS
--model_dir: 必填,模型权重路径--host: 服务ip地址,默认为 6006--port: 服务端口,默认为 0.0.0.0--gpu_memory_utilization: vllm 显存占用率,默认设置为 0.1参考 api_example.py
Word Error Rate (WER) Results for IndexTTS and Baseline Models on the seed-test
| model | zh | en |
|---|---|---|
| Human | 1.254 | 2.143 |
| index-tts (num_beams=3) | 1.005 | 1.943 |
| index-tts (num_beams=1) | 1.107 | 2.032 |
| index-tts-vllm | 1.12 | 1.987 |
基本保持了原项目的性能
目录在 test 文件下
参考 simple_test.py,需先启动 API 服务