From 7353888d35dc42452f980bb58afb0dfac3a72988 Mon Sep 17 00:00:00 2001 From: Tide Date: Wed, 30 Aug 2023 12:20:29 +0800 Subject: [PATCH 1/9] Create README-LINUX-CN.md --- README-LINUX-CN.md | 238 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 README-LINUX-CN.md diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md new file mode 100644 index 0000000..4ab3e40 --- /dev/null +++ b/README-LINUX-CN.md @@ -0,0 +1,238 @@ +## 实时语音克隆 - 中文/普通话 +![mockingbird](https://user-images.githubusercontent.com/12797292/131216767-6eb251d6-14fc-4951-8324-2722f0cd4c63.jpg) + +[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/) + +### [English](README.md) | 中文 + +### [DEMO VIDEO](https://www.bilibili.com/video/BV17Q4y1B7mY/) | [Wiki教程](https://github.com/babysor/MockingBird/wiki/Quick-Start-(Newbie)) | [训练教程](https://vaj2fgg8yn.feishu.cn/docs/doccn7kAbr3SJz0KM0SIDJ0Xnhd) + +## 特性 +🌍 **中文** 支持普通话并使用多种中文数据集进行测试:aidatatang_200zh, magicdata, aishell3, biaobei, MozillaCommonVoice, data_aishell 等 + +🤩 **Easy & Awesome** 仅需下载或新训练合成器(synthesizer)就有良好效果,复用预训练的编码器/声码器,或实时的HiFi-GAN作为vocoder + +🌍 **Webserver Ready** 可伺服你的训练结果,供远程调用。 + +🤩 **感谢各位小伙伴的支持,本项目将开启新一轮的更新** + +## 1.快速开始 +### 1.1 建议环境 +- Ubuntu 18.04 +- Cuda 11.7 && CuDNN 8.5.0 +- Python 3.8 以上 +- Pytorch 2.0.1 +### 1.2 环境配置 +```shell +# 下载前建议更换国内镜像源 + +conda create -n sound python=3.9 + +conda activate sound + +git clone https://github.com/babysor/MockingBird.git + +cd MockingBird + +pip install -r requirements.txt + +pip install webrtcvad-wheels + +pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117 +``` +### 1.3 项目文件结构信息 + +MockingBird + ├── academicodec + ├── utils.py # common parts of various models + ├── modules # common parts of various models + ├── ... + ├── quantization # common parts of various models + └── models # parts that are not shared by various models +.. +├── evaluation_metric +├── examples +│ ├── SoundStream* +│ ├── EnCodec* +│ └── HiFi-Codec* +│ ├── start.sh +│ ├── ... +│ └── test.sh +└── README.md + +### 1.4 模型准备 +> 当实在没有设备或者不想慢慢调试,可以使用社区贡献的模型(欢迎持续分享): + +| 作者 | 下载链接 | 效果预览 | 信息 | +| --- | ----------- | ----- | ----- | +| 作者 | https://pan.baidu.com/s/1iONvRxmkI-t1nHqxKytY3g [百度盘链接](https://pan.baidu.com/s/1iONvRxmkI-t1nHqxKytY3g) 4j5d | | 75k steps 用3个开源数据集混合训练 +| 作者 | https://pan.baidu.com/s/1fMh9IlgKJlL2PIiRTYDUvw [百度盘链接](https://pan.baidu.com/s/1fMh9IlgKJlL2PIiRTYDUvw) 提取码:om7f | | 25k steps 用3个开源数据集混合训练, 切换到tag v0.0.1使用 +|@FawenYo | https://drive.google.com/file/d/1H-YGOUHpmqKxJ9FRc6vAjPuqQki24UbC/view?usp=sharing [百度盘链接](https://pan.baidu.com/s/1vSYXO4wsLyjnF3Unl-Xoxg) 提取码:1024 | [input](https://github.com/babysor/MockingBird/wiki/audio/self_test.mp3) [output](https://github.com/babysor/MockingBird/wiki/audio/export.wav) | 200k steps 台湾口音需切换到tag v0.0.1使用 +|@miven| https://pan.baidu.com/s/1PI-hM3sn5wbeChRryX-RCQ 提取码:2021 | https://www.bilibili.com/video/BV1uh411B7AD/ | 150k steps 注意:根据[issue](https://github.com/babysor/MockingBird/issues/37)修复 并切换到tag v0.0.1使用 + +### 1.5 文件结构准备 +文件结构准备如下所示,算法将自动遍历synthesizer下的.pt模型文件。 +``` +# 以第一个 pretrained-11-7-21_75k.pt 为例 + +└── data + └── ckpt + └── synthesizer + └── pretrained-11-7-21_75k.pt +``` +### 1.6 运行 +``` +python web.py +``` + +## 2.模型训练 +### 2.1 数据准备 +#### 2.1.1 数据下载 +``` shell +# aidatatang_200zh + +wget https://openslr.elda.org/resources/62/aidatatang_200zh.tgz +``` +``` shell +# MAGICDATA + +wget https://openslr.magicdatatech.com/resources/68/train_set.tar.gz + +wget https://openslr.magicdatatech.com/resources/68/dev_set.tar.gz + +wget https://openslr.magicdatatech.com/resources/68/test_set.tar.gz +``` +``` shell +# AISHELL-3 + +wget https://openslr.elda.org/resources/93/data_aishell3.tgz +``` +```shell +# Aishell + +wget https://openslr.elda.org/resources/33/data_aishell.tgz +``` +#### 2.1.2 数据批量解压 +```shell +# 该指令为解压当前目录下的所有压缩文件 + +for gz in *.gz; do tar -zxvf $gz; done +``` +### 2.2 encoder模型训练 +#### 2.2.1 数据预处理: +需要先在`pre.py `头部加入: +```python +import torch +torch.multiprocessing.set_start_method('spawn', force=True) +``` +使用以下指令对数据预处理: +```shell +python pre.py \ + -d +``` +其中``为原数据集路径,`` 为数据集名称。 + +支持 `librispeech_other`,`voxceleb1`,`aidatatang_200zh`,使用逗号分割处理多数据集。 + +### 2.2.2 encoder模型训练: +超参数文件路径:`models/encoder/hparams.py` +```shell +python encoder_train.py \ + /SV2TTS/encoder +``` +其中 `` 是训练产生文件的名称,可自行修改。 + +其中 `` 是经过 `Step 2.1.1` 处理过后的数据集路径。 +#### 2.2.3 开启encoder模型训练数据可视化(可选) +```shell +visdom +``` + +### 2.3 synthesizer模型训练 +#### 2.3.1 数据预处理: +```shell +python pre.py \ + -d \ + -o \ + -n +``` +`` 为原数据集路径,当你的`aidatatang_200zh`路径为`/data/aidatatang_200zh/corpus/train`时,`` 为 `/data/`。 + +`` 为数据集名称。 + +`` 为数据集处理后的保存路径。 + +`` 为数据集处理时进程数,根据CPU情况调整大小。 + +#### 2.3.2 新增数据预处理: +```shell +python pre.py \ + -d \ + -o \ + -n \ + -s +``` +当新增数据集时,应加 `-s` 选择数据拼接,不加则为覆盖。 +#### 2.3.3 synthesizer模型训练: +超参数文件路径:`models/synthesizer/hparams.py`,需将`MockingBird/control/cli/synthesizer_train.py`移成`MockingBird/synthesizer_train.py`结构。 +```shell +python synthesizer_train.py + -m +``` +其中 `` 是训练产生文件的名称,可自行修改。 + +其中 `` 是经过 `Step 2.2.1` 处理过后的数据集路径。 + +其中 ` `为训练时所有数据的保存路径。 + +### 2.4 vocoder模型训练 +vocoder模型对生成效果影响不大,已预置3款。 +#### 2.4.1 数据预处理 +```shell +python vocoder_preprocess.py + -m +``` + +其中``为你数据集路径。 + +其中 ``为synthesizer模型地址。 + +#### 2.4.2 wavernn声码器训练: +``` +python vocoder_train.py +``` +#### 2.4.3 hifigan声码器训练: +``` +python vocoder_train.py hifigan +``` +#### 2.4.4 fregan声码器训练: +``` +python vocoder_train.py --config config.json fregan +``` +将GAN声码器的训练切换为多GPU模式:修改`GAN`文件夹下`.json`文件中的`num_gpus`参数。 + + + + + +## 3.致谢 +### 3.1 项目致谢 +该库一开始从仅支持英语的[Real-Time-Voice-Cloning](https://github.com/CorentinJ/Real-Time-Voice-Cloning) 分叉出来的,鸣谢作者。 +### 3.2 论文致谢 +| URL | Designation | 标题 | 实现源码 | +| --- | ----------- | ----- | --------------------- | +| [1803.09017](https://arxiv.org/abs/1803.09017) | GlobalStyleToken (synthesizer)| Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis | 本代码库 | +| [2010.05646](https://arxiv.org/abs/2010.05646) | HiFi-GAN (vocoder)| Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis | 本代码库 | +| [2106.02297](https://arxiv.org/abs/2106.02297) | Fre-GAN (vocoder)| Fre-GAN: Adversarial Frequency-consistent Audio Synthesis | 本代码库 | +|[**1806.04558**](https://arxiv.org/pdf/1806.04558.pdf) | SV2TTS | Transfer Learning from Speaker Verification to Multispeaker Text-To-Speech Synthesis | 本代码库 | +|[1802.08435](https://arxiv.org/pdf/1802.08435.pdf) | WaveRNN (vocoder) | Efficient Neural Audio Synthesis | [fatchord/WaveRNN](https://github.com/fatchord/WaveRNN) | +|[1703.10135](https://arxiv.org/pdf/1703.10135.pdf) | Tacotron (synthesizer) | Tacotron: Towards End-to-End Speech Synthesis | [fatchord/WaveRNN](https://github.com/fatchord/WaveRNN) +|[1710.10467](https://arxiv.org/pdf/1710.10467.pdf) | GE2E (encoder)| Generalized End-To-End Loss for Speaker Verification | 本代码库 | + +### 3.3 开发者致谢 + +作为一名AI领域的从业者,我们不仅乐于开发一些具有里程碑意义的算法项目,同时也乐于分享项目的成果以及开发当中的喜悦。 +因此,你们的使用是对我们项目的最大认可,同时我们欢迎你们的指正,当你们有想法时可以欢迎issues上留言,这对于项目的后续优化具有十分重大的的意义。 +为了表示感谢,我们将在本项目中留下你们的信息以及相对应的贡献。 + + From d54f4fb631a66ea9cb8e0a48446af577f24008a0 Mon Sep 17 00:00:00 2001 From: Tide Date: Wed, 30 Aug 2023 13:18:33 +0800 Subject: [PATCH 2/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 4ab3e40..7fffc7c 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -40,27 +40,8 @@ pip install webrtcvad-wheels pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117 ``` -### 1.3 项目文件结构信息 - -MockingBird - ├── academicodec - ├── utils.py # common parts of various models - ├── modules # common parts of various models - ├── ... - ├── quantization # common parts of various models - └── models # parts that are not shared by various models -.. -├── evaluation_metric -├── examples -│ ├── SoundStream* -│ ├── EnCodec* -│ └── HiFi-Codec* -│ ├── start.sh -│ ├── ... -│ └── test.sh -└── README.md - -### 1.4 模型准备 + +### 1.3 模型准备 > 当实在没有设备或者不想慢慢调试,可以使用社区贡献的模型(欢迎持续分享): | 作者 | 下载链接 | 效果预览 | 信息 | @@ -70,7 +51,7 @@ MockingBird |@FawenYo | https://drive.google.com/file/d/1H-YGOUHpmqKxJ9FRc6vAjPuqQki24UbC/view?usp=sharing [百度盘链接](https://pan.baidu.com/s/1vSYXO4wsLyjnF3Unl-Xoxg) 提取码:1024 | [input](https://github.com/babysor/MockingBird/wiki/audio/self_test.mp3) [output](https://github.com/babysor/MockingBird/wiki/audio/export.wav) | 200k steps 台湾口音需切换到tag v0.0.1使用 |@miven| https://pan.baidu.com/s/1PI-hM3sn5wbeChRryX-RCQ 提取码:2021 | https://www.bilibili.com/video/BV1uh411B7AD/ | 150k steps 注意:根据[issue](https://github.com/babysor/MockingBird/issues/37)修复 并切换到tag v0.0.1使用 -### 1.5 文件结构准备 +### 1.4 文件结构准备 文件结构准备如下所示,算法将自动遍历synthesizer下的.pt模型文件。 ``` # 以第一个 pretrained-11-7-21_75k.pt 为例 @@ -80,7 +61,7 @@ MockingBird └── synthesizer └── pretrained-11-7-21_75k.pt ``` -### 1.6 运行 +### 1.5 运行 ``` python web.py ``` From baa8b5005dbf405cc751db1dffbe5c033f69e913 Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:05:40 +0800 Subject: [PATCH 3/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 7fffc7c..9773724 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -20,7 +20,7 @@ ### 1.1 建议环境 - Ubuntu 18.04 - Cuda 11.7 && CuDNN 8.5.0 -- Python 3.8 以上 +- Python 3.8 或 3.9 - Pytorch 2.0.1 ### 1.2 环境配置 ```shell From d073e1f34954eba4a3a29145db2ec4c0ea9ea213 Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:24:05 +0800 Subject: [PATCH 4/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 9773724..c50a0ce 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -157,8 +157,8 @@ python pre.py \ #### 2.3.3 synthesizer模型训练: 超参数文件路径:`models/synthesizer/hparams.py`,需将`MockingBird/control/cli/synthesizer_train.py`移成`MockingBird/synthesizer_train.py`结构。 ```shell -python synthesizer_train.py - -m +python synthesizer_train.py \ + -m ``` 其中 `` 是训练产生文件的名称,可自行修改。 @@ -170,7 +170,7 @@ python synthesizer_train.py vocoder模型对生成效果影响不大,已预置3款。 #### 2.4.1 数据预处理 ```shell -python vocoder_preprocess.py +python vocoder_preprocess.py \ -m ``` @@ -184,11 +184,12 @@ python vocoder_train.py ``` #### 2.4.3 hifigan声码器训练: ``` -python vocoder_train.py hifigan +python vocoder_train.py hifigan ``` #### 2.4.4 fregan声码器训练: ``` -python vocoder_train.py --config config.json fregan +python vocoder_train.py \ + --config config.json fregan ``` 将GAN声码器的训练切换为多GPU模式:修改`GAN`文件夹下`.json`文件中的`num_gpus`参数。 From 28f9173dfa6a18db0a766710c5cf93fb698e1c6f Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:34:20 +0800 Subject: [PATCH 5/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index c50a0ce..845f499 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -213,8 +213,13 @@ python vocoder_train.py \ ### 3.3 开发者致谢 -作为一名AI领域的从业者,我们不仅乐于开发一些具有里程碑意义的算法项目,同时也乐于分享项目的成果以及开发当中的喜悦。 -因此,你们的使用是对我们项目的最大认可,同时我们欢迎你们的指正,当你们有想法时可以欢迎issues上留言,这对于项目的后续优化具有十分重大的的意义。 -为了表示感谢,我们将在本项目中留下你们的信息以及相对应的贡献。 +作为AI领域的从业者,我们不仅乐于开发一些具有里程碑意义的算法项目,同时也乐于分享项目以及开发过程中收获的喜悦。 +因此,你们的使用是对我们项目的最大认可。同时当你们在项目使用中遇到一些问题时,欢迎你们随时在issue上留言。你们的指正这对于项目的后续优化具有十分重大的的意义。 +为了表示感谢,我们将在本项目中留下各位开发者信息以及相对应的贡献。 + +* -------------------------------------------------开发者--------------------------------------------------------------------------------- * +- 开发者 id : +- 贡献内容 : +- 时间 : From dbf01347fce9ec5b4fd6ca82a3372a4e42294a5b Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:35:12 +0800 Subject: [PATCH 6/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 845f499..39b3d6f 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -219,7 +219,7 @@ python vocoder_train.py \ 为了表示感谢,我们将在本项目中留下各位开发者信息以及相对应的贡献。 -* -------------------------------------------------开发者--------------------------------------------------------------------------------- * +** -------------------------------------------------开发者--------------------------------------------------------------------------------- ** - 开发者 id : - 贡献内容 : - 时间 : From fd93b403988ef03f6dd2bfc571693f8f0f2a2963 Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:35:34 +0800 Subject: [PATCH 7/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 39b3d6f..830f82f 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -219,7 +219,7 @@ python vocoder_train.py \ 为了表示感谢,我们将在本项目中留下各位开发者信息以及相对应的贡献。 -** -------------------------------------------------开发者--------------------------------------------------------------------------------- ** +- ------------------------------------------------开发者--------------------------------------------------------------------------------- - 开发者 id : - 贡献内容 : - 时间 : From ab79881480122f11291b504b6c6f09e36e526232 Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:40:30 +0800 Subject: [PATCH 8/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 830f82f..68072cd 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -219,7 +219,8 @@ python vocoder_train.py \ 为了表示感谢,我们将在本项目中留下各位开发者信息以及相对应的贡献。 -- ------------------------------------------------开发者--------------------------------------------------------------------------------- -- 开发者 id : -- 贡献内容 : -- 时间 : +- ------------------------------------------------ 开 发 者 贡 献 内 容 --------------------------------------------------------------------------------- +1. - +├── 开发者 : +├── 内容 : +└── 时间 : From 7ab86c6f4c6831a6b7be7794d05ef29396def737 Mon Sep 17 00:00:00 2001 From: Tide <81962026+SeaTidesPro@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:41:45 +0800 Subject: [PATCH 9/9] Update README-LINUX-CN.md --- README-LINUX-CN.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README-LINUX-CN.md b/README-LINUX-CN.md index 68072cd..9d2f026 100644 --- a/README-LINUX-CN.md +++ b/README-LINUX-CN.md @@ -220,7 +220,4 @@ python vocoder_train.py \ 为了表示感谢,我们将在本项目中留下各位开发者信息以及相对应的贡献。 - ------------------------------------------------ 开 发 者 贡 献 内 容 --------------------------------------------------------------------------------- -1. - -├── 开发者 : -├── 内容 : -└── 时间 : +