网站建设近五年出版的书籍,wordpress怎么上传pdf,奥美广告公司排名,网页设计与制作用什么软件做按照固有思维方式#xff0c;深度学习的训练环节应该在云端#xff0c;毕竟本地硬件条件有限。但事实上#xff0c;在语音识别和自然语言处理层面#xff0c;即使相对较少的数据量也可以训练出高性能的模型#xff0c;对于预算有限的同学们来说#xff0c;也没必要花冤枉…
按照固有思维方式深度学习的训练环节应该在云端毕竟本地硬件条件有限。但事实上在语音识别和自然语言处理层面即使相对较少的数据量也可以训练出高性能的模型对于预算有限的同学们来说也没必要花冤枉钱上“云端”了本次我们来演示如何在本地训练Bert-VITS2 V2.0.2模型。
Bert-VITS2 V2.0.2基于现有数据集
目前Bert-VITS2 V2.0.2大体上有两种训练方式第一种是基于现有数据集即原神各角色已经标注好的语音数据这部分内容是公开的但是不能商用可以在这里下载
https://pan.ai-hobbyist.org/Genshin%20Datasets/%E4%B8%AD%E6%96%87%20-%20Chinese/%E5%88%86%E8%A7%92%E8%89%B2%20-%20Single/%E8%A7%92%E8%89%B2%E8%AF%AD%E9%9F%B3%20-%20Character我们只需要选择喜欢的角色进行下载即可 第二种是没有现有的数据集即假设我们想克隆地球人随便任意一个人的声音这种情况下我们需要收集这个人的语音素材然后自己制作数据集。
本次我们只演示第一种训练方式即训练现有数据集的原神角色第二种暂且按下不表。
Bert-VITS2 V2.0.2配置模型
首先克隆项目
git clone https://github.com/v3ucn/Bert-VITS2_V202_Train.git随后下载新版的bert模型
链接https://pan.baidu.com/s/11vLNEVDeP_8YhYIJUjcUeg?pwdv3uc下载成功后解压放入项目的bert目录目录结构如下所示
E:\work\Bert-VITS2-v202\berttree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
│ bert_models.json
│
├───bert-base-japanese-v3
│ config.json
│ README.md
│ tokenizer_config.json
│ vocab.txt
│
├───bert-large-japanese-v2
│ config.json
│ README.md
│ tokenizer_config.json
│ vocab.txt
│
├───chinese-roberta-wwm-ext-large
│ added_tokens.json
│ config.json
│ pytorch_model.bin
│ README.md
│ special_tokens_map.json
│ tokenizer.json
│ tokenizer_config.json
│ vocab.txt
│
├───deberta-v2-large-japanese
│ config.json
│ pytorch_model.bin
│ README.md
│ special_tokens_map.json
│ tokenizer.json
│ tokenizer_config.json
│
└───deberta-v3-large config.json generator_config.json pytorch_model.bin README.md spm.model tokenizer_config.json随后下载预训练模型
https://openi.pcl.ac.cn/Stardust_minus/Bert-VITS2/modelmanage/model_readme_tmpl?nameBert-VITS2%E4%B8%AD%E6%97%A5%E8%8B%B1%E5%BA%95%E6%A8%A1-fix放入项目的pretrained_models目录如下所示
E:\work\Bert-VITS2-v202\pretrained_modelstree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:. DUR_0.pth D_0.pth G_0.pth接着把上文提到的刻晴数据集放入项目的Data目录中的raw目录
E:\work\Bert-VITS2-v202\Data\keqing\raw\keqingtree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
vo_card_keqing_endOfGame_fail_01.lab
vo_card_keqing_endOfGame_fail_01.wav如果想定制化目录结构可以修改config.yml文件
bert_gen: config_path: config.json device: cuda num_processes: 2 use_multi_device: false
dataset_path: Data\keqing
mirror:
openi_token:
preprocess_text: clean: true cleaned_path: filelists/cleaned.list config_path: config.json max_val_total: 8 train_path: filelists/train.list transcription_path: filelists/short_character_anno.list val_path: filelists/val.list val_per_spk: 5
resample: in_dir: raw out_dir: raw sampling_rate: 44100至此模型和数据集就配置好了。
Bert-VITS2 V2.0.2数据预处理
标注好的原始数据集并不能够直接进行训练需要预处理一下首先需要将原始数据文件转写成为标准的标注文件
python3 transcribe_genshin.py生成好的文件
Data\keqing\raw/keqing/vo_card_keqing_endOfGame_fail_01.wav|keqing|ZH|我会勤加练习拿下下一次的胜利。
Data\keqing\raw/keqing/vo_card_keqing_endOfGame_win_01.wav|keqing|ZH|胜负本是常事不必太过挂怀。
Data\keqing\raw/keqing/vo_card_keqing_freetalk_01.wav|keqing|ZH|这「七圣召唤」虽说是游戏但对局之中也隐隐有策算谋略之理。这里ZH代表中文新版的Bert-VITS2 V2.0.2也支持日文和英文代码分别为JP和EN。
随后对文本进行预处理以及生成bert模型可读文件
python3 preprocess_text.py python3 bert_gen.py执行后会产生训练集和验证集文件
E:\work\Bert-VITS2-v202\Data\keqing\fileliststree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:. cleaned.list short_character_anno.list train.list val.list检查无误后数据预处理就完成了。
Bert-VITS2 V2.0.2本地训练
万事俱备只差训练。先不要着急打开Data/keqing/config.json配置文件
{ train: { log_interval: 50, eval_interval: 50, seed: 42, epochs: 200, learning_rate: 0.0001, betas: [ 0.8, 0.99 ], eps: 1e-09, batch_size: 8, fp16_run: false, lr_decay: 0.99995, segment_size: 16384, init_lr_ratio: 1, warmup_epochs: 0, c_mel: 45, c_kl: 1.0, skip_optimizer: false }, data: { training_files: Data/keqing/filelists/train.list, validation_files: Data/keqing/filelists/val.list, max_wav_value: 32768.0, sampling_rate: 44100, filter_length: 2048, hop_length: 512, win_length: 2048, n_mel_channels: 128, mel_fmin: 0.0, mel_fmax: null, add_blank: true, n_speakers: 1, cleaned_text: true, spk2id: { keqing: 0 } }, model: { use_spk_conditioned_encoder: true, use_noise_scaled_mas: true, use_mel_posterior_encoder: false, use_duration_discriminator: true, inter_channels: 192, hidden_channels: 192, filter_channels: 768, n_heads: 2, n_layers: 6, kernel_size: 3, p_dropout: 0.1, resblock: 1, resblock_kernel_sizes: [ 3, 7, 11 ], resblock_dilation_sizes: [ [ 1, 3, 5 ], [ 1, 3, 5 ], [ 1, 3, 5 ] ], upsample_rates: [ 8, 8, 2, 2, 2 ], upsample_initial_channel: 512, upsample_kernel_sizes: [ 16, 16, 8, 2, 2 ], n_layers_q: 3, use_spectral_norm: false, gin_channels: 256 }, version: 2.0
}这里需要调整的参数是batch_size如果显存不够需要往下调整否则会出现“爆显存”的问题假设显存为8G那么该数值最好不要超过8。
与此同时首次训练建议把log_interval和eval_interval参数调小一点即训练的保存间隔方便训练过程中随时进行推理验证。
随后输入命令开始训练
python3 train_ms.py程序返回
11-22 13:20:28 INFO | data_utils.py:61 | Init dataset...
100%|█████████████████████████████████████████████████████████████████████████████| 581/581 [00:0000:00, 48414.40it/s]
11-22 13:20:28 INFO | data_utils.py:76 | skipped: 31, total: 581
11-22 13:20:28 INFO | data_utils.py:61 | Init dataset...
100%|████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00?, ?it/s]
11-22 13:20:28 INFO | data_utils.py:76 | skipped: 0, total: 5
Using noise scaled MAS for VITS2
Using duration discriminator for VITS2
INFO:models:Loaded checkpoint Data\keqing\models\DUR_0.pth (iteration 7)
INFO:models:Loaded checkpoint Data\keqing\models\G_0.pth (iteration 7)
INFO:models:Loaded checkpoint Data\keqing\models\D_0.pth (iteration 7)说明训练已经开始了。
训练过程中可以通过命令
python3 -m tensorboard.main --logdirData/keqing/models来查看loss损失率访问
http://localhost:6006/#scalars一般情况下训练损失率低于50%并且损失函数在训练集和验证集上都趋于稳定则可以认为模型已经收敛。收敛的模型就可以为我们所用了如何使用训练好的模型请移步又欲又撩人,基于新版Bert-vits2V2.0.2音色模型雷电将军八重神子一键推理整合包分享囿于篇幅这里不再赘述。
训练好的模型存放在Data/keqing/models目录
E:\work\Bert-VITS2-v202\Data\keqing\modelstree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
│ DUR_0.pth
│ DUR_550.pth
│ DUR_600.pth
│ DUR_650.pth
│ D_0.pth
│ D_600.pth
│ D_650.pth
│ events.out.tfevents.1700625154.ly.24008.0
│ events.out.tfevents.1700630428.ly.20380.0
│ G_0.pth
│ G_450.pth
│ G_500.pth
│ G_550.pth
│ G_600.pth
│ G_650.pth
│ train.log
│
└───eval events.out.tfevents.1700625154.ly.24008.1 events.out.tfevents.1700630428.ly.20380.1需要注意的是首次训练需要将预训练模型拷贝到models目录。
结语
除了中文Bert-VITS2 V2.0.2也支持日语和英语同时提供中英日混合的Mix推理模式欲知后事如何且听下回分解。 文章转载自: http://www.morning.tpps.cn.gov.cn.tpps.cn http://www.morning.kdfqx.cn.gov.cn.kdfqx.cn http://www.morning.lqgtx.cn.gov.cn.lqgtx.cn http://www.morning.fengnue.com.gov.cn.fengnue.com http://www.morning.wnqbf.cn.gov.cn.wnqbf.cn http://www.morning.pqfbk.cn.gov.cn.pqfbk.cn http://www.morning.ybgcn.cn.gov.cn.ybgcn.cn http://www.morning.mlmwl.cn.gov.cn.mlmwl.cn http://www.morning.lbhck.cn.gov.cn.lbhck.cn http://www.morning.hmsong.com.gov.cn.hmsong.com http://www.morning.fhwfk.cn.gov.cn.fhwfk.cn http://www.morning.jhqcr.cn.gov.cn.jhqcr.cn http://www.morning.xbmwm.cn.gov.cn.xbmwm.cn http://www.morning.lfdmf.cn.gov.cn.lfdmf.cn http://www.morning.dangaw.com.gov.cn.dangaw.com http://www.morning.yxzfl.cn.gov.cn.yxzfl.cn http://www.morning.lqtwb.cn.gov.cn.lqtwb.cn http://www.morning.jpnw.cn.gov.cn.jpnw.cn http://www.morning.mngh.cn.gov.cn.mngh.cn http://www.morning.nqlkb.cn.gov.cn.nqlkb.cn http://www.morning.bmmyx.cn.gov.cn.bmmyx.cn http://www.morning.cjrmf.cn.gov.cn.cjrmf.cn http://www.morning.sqxr.cn.gov.cn.sqxr.cn http://www.morning.qlbmc.cn.gov.cn.qlbmc.cn http://www.morning.ltypx.cn.gov.cn.ltypx.cn http://www.morning.rgsgk.cn.gov.cn.rgsgk.cn http://www.morning.lksgz.cn.gov.cn.lksgz.cn http://www.morning.qzqjz.cn.gov.cn.qzqjz.cn http://www.morning.kggxj.cn.gov.cn.kggxj.cn http://www.morning.ftldl.cn.gov.cn.ftldl.cn http://www.morning.smxrx.cn.gov.cn.smxrx.cn http://www.morning.yfpnl.cn.gov.cn.yfpnl.cn http://www.morning.jgrjj.cn.gov.cn.jgrjj.cn http://www.morning.kwwkm.cn.gov.cn.kwwkm.cn http://www.morning.zdsdn.cn.gov.cn.zdsdn.cn http://www.morning.xoaz.cn.gov.cn.xoaz.cn http://www.morning.mmjyk.cn.gov.cn.mmjyk.cn http://www.morning.rknsp.cn.gov.cn.rknsp.cn http://www.morning.cpkcq.cn.gov.cn.cpkcq.cn http://www.morning.beeice.com.gov.cn.beeice.com http://www.morning.qbksx.cn.gov.cn.qbksx.cn http://www.morning.rsnn.cn.gov.cn.rsnn.cn http://www.morning.nfcxq.cn.gov.cn.nfcxq.cn http://www.morning.cftkz.cn.gov.cn.cftkz.cn http://www.morning.rhsr.cn.gov.cn.rhsr.cn http://www.morning.yongkangyiyuan-pfk.com.gov.cn.yongkangyiyuan-pfk.com http://www.morning.lxdbn.cn.gov.cn.lxdbn.cn http://www.morning.qrlsy.cn.gov.cn.qrlsy.cn http://www.morning.mnclk.cn.gov.cn.mnclk.cn http://www.morning.mwlxk.cn.gov.cn.mwlxk.cn http://www.morning.dpsgq.cn.gov.cn.dpsgq.cn http://www.morning.mtktn.cn.gov.cn.mtktn.cn http://www.morning.pwdgy.cn.gov.cn.pwdgy.cn http://www.morning.trpq.cn.gov.cn.trpq.cn http://www.morning.npxht.cn.gov.cn.npxht.cn http://www.morning.fjmfq.cn.gov.cn.fjmfq.cn http://www.morning.pmsl.cn.gov.cn.pmsl.cn http://www.morning.gwdnl.cn.gov.cn.gwdnl.cn http://www.morning.dlwzm.cn.gov.cn.dlwzm.cn http://www.morning.twdwy.cn.gov.cn.twdwy.cn http://www.morning.yxyyp.cn.gov.cn.yxyyp.cn http://www.morning.fnwny.cn.gov.cn.fnwny.cn http://www.morning.frsxt.cn.gov.cn.frsxt.cn http://www.morning.sjli222.cn.gov.cn.sjli222.cn http://www.morning.brjq.cn.gov.cn.brjq.cn http://www.morning.qwlml.cn.gov.cn.qwlml.cn http://www.morning.htsrm.cn.gov.cn.htsrm.cn http://www.morning.wlstn.cn.gov.cn.wlstn.cn http://www.morning.cklgf.cn.gov.cn.cklgf.cn http://www.morning.ypzsk.cn.gov.cn.ypzsk.cn http://www.morning.gtmgl.cn.gov.cn.gtmgl.cn http://www.morning.yghlr.cn.gov.cn.yghlr.cn http://www.morning.cryb.cn.gov.cn.cryb.cn http://www.morning.cxnyg.cn.gov.cn.cxnyg.cn http://www.morning.fglyb.cn.gov.cn.fglyb.cn http://www.morning.ymwnc.cn.gov.cn.ymwnc.cn http://www.morning.ptxwg.cn.gov.cn.ptxwg.cn http://www.morning.ycmpk.cn.gov.cn.ycmpk.cn http://www.morning.tjkth.cn.gov.cn.tjkth.cn http://www.morning.rqhbt.cn.gov.cn.rqhbt.cn