Skip to content

Latest commit

 

History

History
183 lines (127 loc) · 4.72 KB

dependencies.md

File metadata and controls

183 lines (127 loc) · 4.72 KB

dependencies

在启动服务之前,请确保已安装以下依赖项。

1. Python 和 Git

Python 3.10 和 Git 安装方法:

  • Windows:

    • 下载并运行 Python 3.10 的安装程序: 网页, exe 或 win7 版本。
    • 下载并运行 Git 的安装程序: 网页
  • 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

安装完成之后 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. 后处理工具链

音频后处理操作(如加速、减速、提高音量等)依赖以下库:

  • ffmpeglibav(推荐使用 ffmpeg)

脚本安装

执行此脚本即可自动安装后音频后端

python -m scripts.download_audio_backend

手动安装

若安装脚本失效,可参考下面的指南自行手动安装

Mac(使用 Homebrew:

brew install ffmpeg
brew install rubberband

Linux(使用 aptitude):

apt-get install ffmpeg libavcodec-extra
apt-get install rubberband-cli

Windows:

若你已经安装有 ffmpeg,并可以在命令行中调用,那么无需进行下面的下载和安装

下载 ffmpeg

  1. 此处下载并解压 ffmpeg 的 Windows 二进制文件。
  2. 将 ffmpeg 的/bin文件夹中的 .exe 文件解压到 项目目录/ffmpeg 文件夹内

下载 rubberband

  1. 此处下载并解压 rubberband 的 Windows 二进制文件。
  2. 将 压缩包中 rubberband-3.3.0-gpl-executable-windows 文件夹下的 .exe/.dll 文件解压到 项目目录/ffmpeg 文件夹内

文件 (window) 目录应该如下

./ffmpeg
├── ffmpeg.exe
├── ffprobe.exe
├── ffplay.exe
├── ffplay.exe
├── rubberband.exe
├── rubberband-r3.exe
├── sndfile.dll
└── put_ffmpeg_here

5. 安装 python 依赖

pytorch

由于 pytroch 安装与你的本机环境有关,请自行安装对应版本,下面是一个简单的安装脚本

(如果直接运行某些情况可能会安装 cpu 版本,具体应该指定什么版本请自行确定)

pip3 install torch torchvision torchaudio --index-url https://mirror.sjtu.edu.cn/pytorch-wheels/cu121

如果上面无法安装 cuda 版本,可以参考下面的指令安装指定版本 torch (linux)

pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu121/torch-2.3.1%2Bcu121-cp310-cp310-linux_x86_64.whl
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu121/torchaudio-2.3.1%2Bcu121-cp310-cp310-linux_x86_64.whl
pip3 install https://mirror.sjtu.edu.cn/pytorch-wheels/cu121/torchvision-0.18.1%2Bcu121-cp310-cp310-linux_x86_64.whl

flash attn (可选)

详见: https://github.com/Dao-AILab/flash-attention

其余依赖

python -m pip install -r requirements.txt

对于 windows 环境,请使用 requirements.windows.txt

因为有类似 pynini 这样的可选依赖库不支持在 windows 环境安装

python -m pip install -r requirements.windows.txt

6. 其他

如果需要部署 Docker 环境,请配置 Docker 和 Docker Compose。