VITS2 Backbone with bert
conda create -n Bert-VITS2 python=3.8
conda activate Bert-VITS2
conda install -c "nvidia/label/cuda-11.7.1" cuda-toolkit
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
pip install -r requirements.txt
conda install -c conda-forge ffmpeg
cd monotonic_align && python setup.py build_ext --inplace && cd ..
下载 bert 模型,并放置到 bert/chinese-roberta-wwm-ext-large 目录中
- 首先将训练用的 wav 格式音频文件放置到 workspace/raw_audio 目录下。
- 文件命名规则为 <说话人>_<任意数字>.wav,如 paimeng_1.wav、paimeng_2.wav。
- 可以同时放置多个说话人的多个音频文件。
python scripts/denoise_audio.py
python scripts/transcribe_audio.py
- 默认使用 whisper 的 large 模型,12G 以下显存可以使用
--whisper_size medium
加载 medium 模型。 - 首次运行会从 Hugging Face 拉取模型权重文件。
python scripts/transcribe_audio.py --whisper_size medium
python resample.py
python preprocess_text.py
python bert_gen.py
- 运行如下命令开始训练,使用
-m
参数指定训练名称,会在 ./logs/ 目录下创建同名目录存放权重文件。
python train_ms.py -m test
- 如果要继续之前中断的训练,可以使用
--resume
参数。
python train_ms.py -m test --resume
- 运行如下命令会自动在浏览器中打开
http://127.0.0.1:7860
,使用-c
参数指定配置文件,-m
参数指定权重文件。
python webui.py -c ./logs/test/config.json -m ./logs/test/G_2000.pth
- Google Colab 等场合可以使用
--share
参数,生成可内网穿透的链接。
python webui.py -c ./logs/test/config.json -m ./logs/test/G_2000.pth --share
- 运行如下命令后会启动 API 并监听
http://0.0.0.0:8000
。 - 可访问
http://127.0.0.1:8000/docs
查看 API 手册。
python api.py -c ./logs/test/config.json -m ./logs/test/G_2000.pth
- 参考 colab.ipynb