前置条件:
- 已安装cuda套件
- 已安装Python
- 建议使用UV
安装Git和Git-fls
git lfs install
克隆Git仓库并下载代码
git clone https://github.com/index-tts/index-tts.git
cd index-tts
git lfs pull
安装uv
pip install -U uv --root-user-action=ignore
安装项目相关依赖
直接使用官方源:
uv sync --all-extras
切换国内源:
下列出阿里和清华两个源
uv sync --all-extras --default-index "https://mirrors.aliyun.com/pypi/simple"
uv sync --all-extras --default-index "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
下载模型
huggingface:
uv tool install "huggingface-hub[cli,hf_xet]"
hf download IndexTeam/IndexTTS-2 --local-dir=checkpoints
modelscope:
uv tool install "modelscope"
modelscope download --model IndexTeam/IndexTTS-2 --local_dir checkpoints
huggingface-mirror:
export HF_ENDPOINT="https://hf-mirror.com"
hf download IndexTeam/IndexTTS-2 --local-dir=checkpoints
检测GPU加速是否可用
非必需,但加速可用生成时间快些
uv run tools/gpu_check.py
显示**"Your system is ready!"**即为加速正常可用
开始运行
查看可自定义项:
uv run webui.py -h
usage: webui.py [-h] [--verbose] [--port PORT] [--host HOST] [--model_dir MODEL_DIR] [--fp16] [--deepspeed] [--cuda_kernel] [--gui_seg_tokens GUI_SEG_TOKENS]
IndexTTS WebUI
options:
-h, --help show this help message and exit
--verbose Enable verbose mode (default: False)
--port PORT Port to run the web UI on (default: 7860)
--host HOST Host to run the web UI on (default: 0.0.0.0)
--model_dir MODEL_DIR
Model checkpoints directory (default: ./checkpoints)
--fp16 Use FP16 for inference if available (default: False)
--deepspeed Use DeepSpeed to accelerate if available (default: False)
--cuda_kernel Use CUDA kernel for inference if available (default: False)
--gui_seg_tokens GUI_SEG_TOKENS
GUI: Max tokens per generation segment (default: 120)
正式运行:
开启了deepspeed加速和cuda内核编译加速
开启比较慢,耐心等待
uv run webui.py --port 8888 --deepspeed --cuda_kernel
等待提示**"Running on local URL: http://0.0.0.0:8888"**即可浏览器打开进行访问