This action will force synchronization from babysor/MockingBird, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
🌍 中文 支持普通话并使用多种中文数据集进行测试:aidatatang_200zh, magicdata, aishell3, biaobei, MozillaCommonVoice, data_aishell 等
🤩 PyTorch 适用于 pytorch,已在 1.9.0 版本(最新于 2021 年 8 月)中测试,GPU Tesla T4 和 GTX 2060
🌍 Windows + Linux 可在 Windows 操作系统和 linux 操作系统中运行(苹果系统M1版也有社区成功运行案例)
🤩 Easy & Awesome 仅需下载或新训练合成器(synthesizer)就有良好效果,复用预训练的编码器/声码器,或实时的HiFi-GAN作为vocoder
🌍 Webserver Ready 可伺服你的训练结果,供远程调用
按照原始存储库测试您是否已准备好所有环境。 Python 3.7 或更高版本 需要运行工具箱。
如果在用 pip 方式安装的时候出现
ERROR: Could not find a version that satisfies the requirement torch==1.9.0+cu102 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
这个错误可能是 python 版本过低,3.9 可以安装成功
pip install -r requirements.txt
来安装剩余的必要包。pip install webrtcvad-wheels
。考虑训练您自己专属的模型或者下载社区他人训练好的模型:
近期创建了知乎专题 将不定期更新炼丹小技巧or心得,也欢迎提问
python pre.py <datasets_root> -d {dataset} -n {number}
可传入参数:{dataset}
指定数据集,支持 aidatatang_200zh, magicdata, aishell3, data_aishell, 不传默认为aidatatang_200zh{number}
指定并行数,CPU 11770k + 32GB实测10没有问题假如你下载的
aidatatang_200zh
文件放在D盘,train
文件路径为D:\data\aidatatang_200zh\corpus\train
, 你的datasets_root
就是D:\data\
训练合成器:
python synthesizer_train.py mandarin <datasets_root>/SV2TTS/synthesizer
当您在训练文件夹 synthesizer/saved_models/ 中看到注意线显示和损失满足您的需要时,请转到启动程序
一步。
当实在没有设备或者不想慢慢调试,可以使用社区贡献的模型(欢迎持续分享):
作者 | 下载链接 | 效果预览 | 信息 |
---|---|---|---|
作者 | https://pan.baidu.com/s/1fMh9IlgKJlL2PIiRTYDUvw 百度盘链接 提取码:om7f | 25k steps 用3个开源数据集混合训练 | |
@FawenYo | https://drive.google.com/file/d/1H-YGOUHpmqKxJ9FRc6vAjPuqQki24UbC/view?usp=sharing 百度盘链接 提取码:1024 | input output | 200k steps 台湾口音需切换到2021-10-22之前代码节点使用 |
@miven | https://pan.baidu.com/s/1PI-hM3sn5wbeChRryX-RCQ 提取码:2021 | https://www.bilibili.com/video/BV1uh411B7AD/ | 150k steps 旧版需根据issue修复 并切换到2021-10-22之前代码节点使用 |
对效果影响不大,已经预置3款,如果希望自己训练可以参考以下命令。
python vocoder_preprocess.py <datasets_root> -m <synthesizer_model_path>
<datasets_root>
替换为你的数据集目录,<synthesizer_model_path>
替换为一个你最好的synthesizer模型目录,例如 sythensizer\saved_mode\xxx
python vocoder_train.py <trainid> <datasets_root>
<trainid>
替换为你想要的标识,同一标识再次训练时会延续原模型
python vocoder_train.py <trainid> <datasets_root> hifigan
<trainid>
替换为你想要的标识,同一标识再次训练时会延续原模型
您可以尝试使用以下命令:
python web.py
运行成功后在浏览器打开地址, 默认为 http://localhost:8080
注:目前界面比较buggy,
- 第一次点击
录制
要等待几秒浏览器正常启动录音,否则会有重音- 录制结束不要再点
录制
而是停止
- 仅支持手动新录音(16khz), 不支持超过4MB的录音,最佳长度在5~15秒
- 默认使用第一个找到的模型,有动手能力的可以看代码修改
web\__init__.py
。
python demo_toolbox.py -d <datasets_root>
请指定一个可用的数据集文件路径,如果有支持的数据集则会自动加载供调试,也同时会作为手动录制音频的存储目录。
├─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端入口文件
该库一开始从仅支持英语的Real-Time-Voice-Cloning 分叉出来的,鸣谢作者。
URL | Designation | 标题 | 实现源码 |
---|---|---|---|
1803.09017 | GlobalStyleToken (synthesizer) | Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis | 本代码库 |
2010.05646 | HiFi-GAN (vocoder) | Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis | 本代码库 |
1806.04558 | SV2TTS | Transfer Learning from Speaker Verification to Multispeaker Text-To-Speech Synthesis | 本代码库 |
1802.08435 | WaveRNN (vocoder) | Efficient Neural Audio Synthesis | fatchord/WaveRNN |
1703.10135 | Tacotron (synthesizer) | Tacotron: Towards End-to-End Speech Synthesis | fatchord/WaveRNN |
1710.10467 | GE2E (encoder) | Generalized End-To-End Loss for Speaker Verification | 本代码库 |
数据集 | OpenSLR地址 | 其他源 (Google Drive, Baidu网盘等) |
---|---|---|
aidatatang_200zh | OpenSLR | Google Drive |
magicdata | OpenSLR | Google Drive (Dev set) |
aishell3 | OpenSLR | Google Drive |
data_aishell | OpenSLR |
解壓 aidatatang_200zh 後,還需將
aidatatang_200zh\corpus\train
下的檔案全選解壓縮
<datasets_root>
是什麼意思?假如數據集路徑為 D:\data\aidatatang_200zh
,那麼 <datasets_root>
就是 D:\data
訓練合成器時:將 synthesizer/hparams.py
中的batch_size參數調小
//調整前
tts_schedule = [(2, 1e-3, 20_000, 12), # Progressive training schedule
(2, 5e-4, 40_000, 12), # (r, lr, step, batch_size)
(2, 2e-4, 80_000, 12), #
(2, 1e-4, 160_000, 12), # r = reduction factor (# of mel frames
(2, 3e-5, 320_000, 12), # synthesized for each decoder iteration)
(2, 1e-5, 640_000, 12)], # lr = learning rate
//調整後
tts_schedule = [(2, 1e-3, 20_000, 8), # Progressive training schedule
(2, 5e-4, 40_000, 8), # (r, lr, step, batch_size)
(2, 2e-4, 80_000, 8), #
(2, 1e-4, 160_000, 8), # r = reduction factor (# of mel frames
(2, 3e-5, 320_000, 8), # synthesized for each decoder iteration)
(2, 1e-5, 640_000, 8)], # lr = learning rate
聲碼器-預處理數據集時:將 synthesizer/hparams.py
中的batch_size參數調小
//調整前
### Data Preprocessing
max_mel_frames = 900,
rescale = True,
rescaling_max = 0.9,
synthesis_batch_size = 16, # For vocoder preprocessing and inference.
//調整後
### Data Preprocessing
max_mel_frames = 900,
rescale = True,
rescaling_max = 0.9,
synthesis_batch_size = 8, # For vocoder preprocessing and inference.
聲碼器-訓練聲碼器時:將 vocoder/wavernn/hparams.py
中的batch_size參數調小
//調整前
# Training
voc_batch_size = 100
voc_lr = 1e-4
voc_gen_at_checkpoint = 5
voc_pad = 2
//調整後
# Training
voc_batch_size = 6
voc_lr = 1e-4
voc_gen_at_checkpoint = 5
voc_pad =2
RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([70, 512]) from checkpoint, the shape in current model is torch.Size([75, 512]).
請參照 issue #37
適情況調整batch_size參數來改善
頁面文件太小,無法完成操作
請參考這篇文章,將虛擬內存更改為100G(102400),例如:档案放置D槽就更改D槽的虚拟内存
首先一定要出现注意力模型,其次是loss足够低,取决于硬件设备和数据集。拿本人的供参考,我的注意力是在 18k 步之后出现的,并且在 50k 步之后损失变得低于 0.4
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。