dependencies
February 1, 2026 · View on GitHub
在启动服务之前,请确保已安装以下依赖项。
1. Python 和 Git
Python 3.10 和 Git 安装方法:
-
Windows:
-
Linux (基于 Debian 的发行版):
sudo apt install wget git python3 python3-venv -
Linux (基于 Red Hat 的发行版):
sudo dnf install wget git python3 -
Linux (基于 Arch 的发行版):
sudo pacman -S wget git python3
2. 下载仓库代码
执行以下命令将本仓库代码克隆到本地:
git clone https://github.com/lenML/ChatTTS-Forge.git --depth=1
3. 模型文件
-
自行下载(任选其一):
-
使用脚本下载(任选其一):
- 从 HuggingFace 下载:
python -m scripts.download_models --source huggingface - 从 ModelScope 下载:
python -m scripts.download_models --source modelscope
- 从 HuggingFace 下载:
安装完成之后 models 文件夹应该如下
./models
├── ChatTTS
│ ├── asset
│ │ ├── DVAE.pt
│ │ ├── Decoder.pt
│ │ ├── GPT.pt
│ │ ├── Vocos.pt
│ │ ├── spk_stat.pt
│ │ └── tokenizer.pt
│ └── config
│ ├── decoder.yaml
│ ├── dvae.yaml
│ ├── gpt.yaml
│ ├── path.yaml
│ └── vocos.yaml
├── put_model_here
└── resemble-enhance
├── hparams.yaml
└── mp_rank_00_model_states.pt
4. 后处理工具链
音频后处理操作(如加速、减速、提高音量等)依赖以下库:
- ffmpeg 或 libav(推荐使用 ffmpeg)
脚本安装
执行此脚本即可自动安装后音频后端
python -m scripts.download_audio_backend
手动安装
若安装脚本失效,可参考下面的指南自行手动安装
Mac(使用 Homebrew):
brew install ffmpeg
brew install rubberband
brew install sox
Linux(使用 aptitude):
apt-get install ffmpeg libavcodec-extra
apt-get install rubberband-cli
apt-get install sox
Windows:
若你已经安装有 ffmpeg,并可以在命令行中调用,那么无需进行下面的下载和安装
下载 ffmpeg
- 从此处下载并解压 ffmpeg 的 Windows 二进制文件。
- 将 ffmpeg 的
/bin文件夹中的 .exe 文件解压到项目目录/ffmpeg文件夹内 (或者系统Path路径内)
下载 rubberband
- 从此处下载并解压 rubberband 的 Windows 二进制文件。
- 将 压缩包中
rubberband-3.3.0-gpl-executable-windows文件夹下的 .exe/.dll 文件解压到项目目录/ffmpeg文件夹内 (或者系统Path路径内)
下载 sox (Qwen3TTS依赖)
- 从此处下载并解压
- 将 压缩包中
sox.exe文件解压到项目目录/ffmpeg文件夹内(或者系统Path路径内)
文件 (window) 目录应该如下
./ffmpeg
├── ffmpeg.exe
├── ffprobe.exe
├── ffplay.exe
├── rubberband.exe
├── rubberband-r3.exe
├── sndfile.dll
└── put_ffmpeg_here
5. 安装 python 依赖
pytorch
建议版本: torch==2.6.0+cu126
由于 pytroch 安装与你的本机环境有关,请自行安装对应版本,下面是一个简单的安装脚本
(如果直接运行某些情况可能会安装 cpu 版本,具体应该指定什么版本请自行确定)
pip3 install torch==2.6.0 torchvision torchaudio --index-url https://mirror.sjtu.edu.cn/pytorch-wheels/cu126
如果上面无法安装 cuda 版本,可以参考下面的指令安装指定版本 torch (linux)
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu126/torch-2.6.0%2Bcu126-cp310-cp310-linux_x86_64.whl
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu126/torchaudio-2.6.0%2Bcu126-cp310-cp310-linux_x86_64.whl
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu126/torchvision-0.21.0%2Bcu126-cp310-cp310-linux_x86_64.whl
windows
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu126/torch-2.6.0%2Bcu126-cp310-cp310-win_amd64.whl
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu126/torchaudio-2.6.0%2Bcu126-cp310-cp310-win_amd64.whl
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu126/torchvision-0.21.0%2Bcu126-cp310-cp310-win_amd64.whl
flash attn (可选)
pip install flash-attn --no-build-isolation
详见: https://github.com/Dao-AILab/flash-attention
xformers (可选)
几乎没用,因为tts模型不是所有模块都能支持,这里提供一个和 torch==2.6.0+cu126 兼容的版本,方便配置
pip3 install -U xformers==0.0.27 --index-url https://download.pytorch.org/whl/cu126 --no-deps
其余依赖
python -m pip install -r requirements.txt
6. 其他
如果需要部署 Docker 环境,请配置 Docker 和 Docker Compose。
- Docker: https://docs.docker.com/get-docker/
- Docker Compose: https://docs.docker.com/compose/