MockingBird(语音克隆)教程
2021年10月13日 2022年8月26日
项目地址:https://github.com/babysor/MockingBird
官方文档:https://github.com/babysor/MockingBird/blob/main/README-CN.md
安装vc++14.0编译工具solved_packageMissInInstalling_mu_visual_cpp_build_tools_2015_update_3_x64_dvd_dfd9a39c.iso
链接: https://pan.baidu.com/s/1Rfbn4IKQ_H7vXAfSUJkhKA?pwd=srjk 提取码: srjk
创建python虚拟环境(Python 3.7 或更高版本):
1 |
conda create -n MyMockingBird python=3.9.6 |
激活
1 |
conda activate MyMockingBird |
conda install很慢使用清华源
1 2 3 |
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --set show_channel_urls yes |
安装 PyTorch
1 |
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch |
安装 ffmpeg
FFMPEG
https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
下载并添加到系统路径(仅限bin目录)
cd到MockingBird目录下安装剩余的必要包
1 2 3 4 5 6 7 |
(MyMockingBird) C:\Users\qihonglu>d: (MyMockingBird) D:\>cd github\MockingBird-main #解决pip install慢的办法可以在使用pip的时候加参数 -i https://pypi.tuna.tsinghua.edu.cn/simple (MyMockingBird) D:\github\MockingBird-main>pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple |
安装 webrtcvad
1 |
pip install webrtcvad-wheels -i https://pypi.tuna.tsinghua.edu.cn/simple |
考虑训练您自己专属的模型或者下载社区他人训练好的模型:
这里我使用社区预先训练好的模型
https://pan.baidu.com/s/1VHSKIbxXQejtxi2at9IrpA 百度盘链接 提取码:i183
把训练好的模型放入D:\github\MockingBird-main\synthesizer\saved_models
训练声码器 (可选)
略….
启动Web程序:
python web.py
运行成功后在浏览器打开地址, 默认为 http://localhost:8080
启动工具箱:
1 2 3 |
python demo_toolbox.py -d <datasets_root> #<datasets_root>为模型存放的目录,如下: python demo_toolbox.py -d D:\github\MockingBird-main\synthesizer\saved_models |
请指定一个可用的数据集文件路径,如果有支持的数据集则会自动加载供调试,也同时会作为手动录制音频的存储目录。
文件结构(目标读者:开发者)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
├─archived_untest_files 废弃文件 ├─encoder encoder模型 │ ├─data_objects │ └─saved_models 预训练好的模型 ├─samples 样例语音 ├─synthesizer synthesizer模型 │ ├─models │ ├─saved_models 预训练好的模型 │ └─utils 工具类库 ├─toolbox 图形化工具箱 ├─utils 工具类库 ├─vocoder vocoder模型(目前包含hifi-gan、wavrnn) │ ├─hifigan │ ├─saved_models 预训练好的模型 │ └─wavernn └─web ├─api │ └─Web端接口 ├─config │ └─ Web端配置文件 ├─static 前端静态脚本 │ └─js ├─templates 前端模板 └─__init__.py Web端入口文件 |