Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
index-tts-vllm
Commits
47249325
Commit
47249325
authored
Jan 08, 2026
by
yangzhong
Browse files
Update README.md
parent
ab9c00af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
149 deletions
+133
-149
README.md
README.md
+133
-149
No files found.
README.md
View file @
47249325
<a
href=
"README.md"
>
中文
</a>
|
<a
href=
"README_EN.md"
>
English
</a>
<div
align=
"center"
>
# IndexTTS-vLLM
</div>
## 项目简介
该项目在
[
index-tts
](
https://github.com/index-tts/index-tts
)
的基础上使用 vllm 库重新实现了 gpt 模型的推理,加速了 index-tts 的推理过程。
推理速度(Index-TTS-v1/v1.5)在单卡 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`
)
## 更新日志
-
**[2025-09-22]**
支持了 vllm v1 版本,IndexTTS2 正在兼容中
-
**[2025-09-28]**
支持了 IndexTTS2 的 webui 推理,并整理了权重文件,现在部署更加方便了!
\0
.0/ ;但当前版本对于 IndexTTS2 的 gpt 似乎并没有加速效果,待研究
-
**[2025-09-29]**
解决了 IndexTTS2 的 gpt 模型推理加速无效的问题
-
**[2025-10-09]**
兼容 IndexTTS2 的 api 接口调用,请参考
[
API
](
#api
)
;v1/1.5 的 api 接口以及 openai 兼容的接口可能还有 bug,晚点再修
-
**[2025-10-19]**
支持 qwen0.6bemo4-merge 的 vllm 推理
## TODO list
-
V2 api 的并发优化:目前只有 gpt2 模型的推理是并行的,其他模块均是串行,而其中 s2mel 的推理开销大(需要 DiT 迭代 25 步),十分影响并发性能
-
s2mel 的推理加速
## 使用步骤
### 1. git 本项目
```
bash
git clone https://github.com/Ksuriuri/index-tts-vllm.git
cd
index-tts-vllm
```
### 2. 创建并激活 conda 环境
```
bash
conda create
-n
index-tts-vllm
python
=
3.12
conda activate index-tts-vllm
```
### 3. 安装 pytorch
需要 pytorch 版本 2.8.0(对应 vllm 0.10.2),具体安装指令请参考:
[
pytorch 官网
](
https://pytorch.org/get-started/locally/
)
### 4. 安装依赖
```
bash
pip
install
-r
requirements.txt
```
### 5. 下载模型权重
#### 自动下载(推荐)
选择对应版本的模型权重下载到
`checkpoints/`
路径下:
```
bash
# 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
```
#### 手动下载
-
ModelScope:
[
Index-TTS
](
https://www.modelscope.cn/models/kusuriuri/Index-TTS-vLLM
)
|
[
IndexTTS-1.5
](
https://www.modelscope.cn/models/kusuriuri/Index-TTS-1.5-vLLM
)
|
[
IndexTTS-2
](
https://www.modelscope.cn/models/kusuriuri/IndexTTS-2-vLLM
)
#### 自行转换原权重(可选,不推荐)
可以使用
`convert_hf_format.sh`
自行转换官方权重文件:
```
bash
bash convert_hf_format.sh /path/to/your/model_dir
```
### 6. webui 启动!
运行对应版本(第一次启动可能会久一些,因为要对 bigvgan 进行 cuda 核编译):
```
bash
# Index-TTS 1.0
python webui.py
# IndexTTS-1.5
python webui.py
--version
1.5
# IndexTTS-2
python webui_v2.py
```
## API
使用 fastapi 封装了 api 接口,启动示例如下:
```
bash
# Index-TTS-1.0/1.5
python api_server.py
# IndexTTS-2
python api_server_v2.py
```
### 启动参数
-
`--model_dir`
: 必填,模型权重路径
-
`--host`
: 服务ip地址,默认为
`0.0.0.0`
-
`--port`
: 服务端口,默认为
`6006`
-
`--gpu_memory_utilization`
: vllm 显存占用率,默认设置为
`0.25`
### API 请求示例
-
v1/1.5 请参考
`api_example.py`
-
v2 请参考
`api_example_v2.py`
### OpenAI API
-
添加 /audio/speech api 路径,兼容 OpenAI 接口
-
添加 /audio/voices api 路径, 获得 voice/character 列表
详见:
[
createSpeech
](
https://platform.openai.com/docs/api-reference/audio/createSpeech
)
## 新特性
-
**v1/v1.5:**
支持多角色音频混合:可以传入多个参考音频,TTS 输出的角色声线为多个参考音频的混合版本(输入多个参考音频会导致输出的角色声线不稳定,可以抽卡抽到满意的声线再作为参考音频)
## 性能
Word Error Rate (WER) Results for IndexTTS and Baseline Models on the
[
**seed-test**
](
https://github.com/BytedanceSpeech/seed-tts-eval
)
| 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 |
基本保持了原项目的性能
## 并发测试
参考
[
`simple_test.py`
](
simple_test.py
)
,需先启动 API 服务
# IndexTTS-vLLM
## 论文
IndexTTS2: A Breakthrough in Emotionally Expressive and Duration-Controlled Auto-Regressive Zero-Shot Text-to-Speech
https://arxiv.org/abs/2506.21619
## 模型结构
IndexTTS2 是 B 站提出的零样本可控 TTS 模型,采用 “自回归 + 非自回归” 级联架构,核心由 Text‑to‑Semantic(T2S)、Semantic‑to‑Mel(S2M)、BigVGANv2 声码器 三大模块组成,支持精确时长控制与情感‑音色解耦,适配零样本语音合成与视频配音等场景。
模型采用三阶段流水线,输入文本、音色 / 风格提示、可选时长控制,输出高保真语音,流程如下:
1.
文本→语义 Token(T2S):自回归生成带时长 / 情感约束的语义 Token;
2.
语义 Token→梅尔频谱(S2M):非自回归流匹配生成梅尔谱,融入 GPT 隐表示保障情感清晰度;
3.
梅尔频谱→波形(声码器):BigVGANv2 转波形,兼顾音质与推理速度。

## 环境配置
### Docker(方法一)
```
在光源可拉取docker镜像:
docker pull image.sourcefind.cn:5000/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.1-rc5-rocblas104381-0915-das1.6-py3.10-20250916-rc2-ds3.2
创建并启动容器:
docker run -it --network=host --name=dtk25041_torch25 -v /opt/hyhal:/opt/hyhal:ro -v /usr/local/hyhal:/usr/local/hyhal:ro -v /public:/public:ro --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=128G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 image.sourcefind.cn:5000/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.1-rc5-rocblas104381-0915-das1.6-py3.10-20250916-rc2-ds3.2
docker exec -it dtk25041_torch25 /bin/bash
安装依赖包:
cd index-tts-vllm/
pip install http://112.11.119.99:18000/customized/vllm/dtk25.04.1/vllm-0.10.2%2Bdas.opt1.alpha.dfe1a84.dtk25041-cp310-cp310-linux_x86_64.whl # 安装vllm0.10.2
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install http://112.11.119.99:18000/customized/torchaudio/dtk25.04.2/torchaudio251-hip/torchaudio-2.5.1%2Bdas.opt1.dtk25042-cp310-cp310-manylinux_2_28_x86_64.whl --force-reinstall --no-deps # 安装指定版本的torchaudio
# 安装Qt5
apt update && apt install -y libqt5core5a libgstreamer-plugins-good1.0-0 gstreamer1.0-plugins-base
# vllm必须安装指定的0.10.2版本,torchaudio需要卸载安装指定whl包
```
### Dockerfile(方法二)
```
docker build --no-cache -t index-tts-vllm:latest .
docker run -dit --network=host --name=index-tts-vllm --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 -v /opt/hyhal/:/opt/hyhal/:ro -v /usr/local/hyhal:/usr/local/hyhal:ro index-tts-vllm:latest
docker exec -it index-tts-vllm /bin/bash
安装依赖包:
cd index-tts-vllm/
pip install http://112.11.119.99:18000/customized/vllm/dtk25.04.1/vllm-0.10.2%2Bdas.opt1.alpha.dfe1a84.dtk25041-cp310-cp310-linux_x86_64.whl # 安装vllm0.10.2
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install http://112.11.119.99:18000/customized/torchaudio/dtk25.04.2/torchaudio251-hip/torchaudio-2.5.1%2Bdas.opt1.dtk25042-cp310-cp310-manylinux_2_28_x86_64.whl --force-reinstall --no-deps # 安装指定版本的torchaudio
# 安装Qt5
apt update && apt install -y libqt5core5a libgstreamer-plugins-good1.0-0 gstreamer1.0-plugins-base
# vllm必须安装指定的0.10.2版本,torchaudio需要卸载安装指定whl包
```
### Anaconda(方法三)
```
1.创建conda虚拟环境:
conda create -n index-tts-vllm python=3.10
2.关于本项目DCU显卡所需的工具包、深度学习库等均可从光合开发者社区下载安装:https://developer.hpccube.com/tool/
DTK驱动:dtk25.04.1
python:python3.10
torch:2.5.1
Tips:以上DTK、python、torch等DCU相关工具包,版本需要严格一一对应
3.其它非特殊库参照requirements.txt安装
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install http://112.11.119.99:18000/customized/vllm/dtk25.04.1/vllm-0.10.2%2Bdas.opt1.alpha.dfe1a84.dtk25041-cp310-cp310-linux_x86_64.whl # 安装vllm0.10.2
pip install http://112.11.119.99:18000/customized/torchaudio/dtk25.04.2/torchaudio251-hip/torchaudio-2.5.1%2Bdas.opt1.dtk25042-cp310-cp310-manylinux_2_28_x86_64.whl --force-reinstall --no-deps # 安装指定版本的torchaudio
# 安装Qt5
apt update && apt install -y libqt5core5a libgstreamer-plugins-good1.0-0 gstreamer1.0-plugins-base
# vllm必须安装指定的0.10.2版本,torchaudio需要卸载安装指定whl包
```
## 测试数据集
无
## 预训练模型
模型权重下载到
`checkpoints/`
路径下:
```
modelscope download --model kusuriuri/IndexTTS-2-vLLM --local_dir ./checkpoints/IndexTTS-2-vLLM
```
## 推理
#### 单机单卡推理
使用 fastapi 封装了 api 接口,启动示例如下:
```
python api_server_v2.py
```
#### 启动参数
-
`--model_dir`
: 必填,模型权重路径
-
`--host`
: 服务ip地址,默认为
`0.0.0.0`
-
`--port`
: 服务端口,默认为
`6006`
-
`--gpu_memory_utilization`
: vllm 显存占用率,默认设置为
`0.25`
#### API 请求示例
```
python api_example_v2.py
```
## result
无
## 精度
无
### 应用场景
### 算法类别
文本转语音(TTS)领域
### 热点应用行业
医疗,教育,科研,游戏娱乐
## 源码仓库及问题反馈
-
https://developer.sourcefind.cn/codes/modelzoo/index-tts-vllm
## 参考资料
-
https://github.com/Ksuriuri/index-tts-vllm
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment