近日,Bert-vits2发布了最新的版本2.3-final,意为最终版,修复了一些已知的bug,添加基于 WavLM 的 Discriminator(来源于 StyleTTS2),令人意外的是,因情感控制效果不佳,去除了 CLAP情感模型,换成了相对简单的 BERT 融合语义方式。
事实上,经过2.2版本的测试,CLAP情感模型的效果还是不错的,关于2.2版本,请移步:
Bert-vits2-v2.2新版本本地训练推理整合包(原神八重神子英文模型miko)
更多情报请关注Bert-vits2官网:
https://github.com/fishaudio/Bert-VITS2/releases/tag/v2.3
本次我们基于最新版Bert-vits2-2.3来复刻生化危机经典角色艾达王(ada wong)的声音。
Bert-vits2-2.3项目配置
首先克隆项目:
git clone https://github.com/v3ucn/Bert-vits2-V2.3.git
注意该项目fork自Bert-vits2的2.3分支,在其基础上增加了素材切分和转写标注等功能,更易于使用。
随后进入项目:
cd Bert-vits2-V2.3
安装依赖:
pip3 install -r requirements.txt
随后下载对应的模型,首先是bert模型:
https://openi.pcl.ac.cn/Stardust_minus/Bert-VITS2/modelmanage/show_model
放入到bert目录:
E:\work\Bert-VITS2-2.3\bert>tree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
│ bert_models.json
│
├───bert-base-japanese-v3
│ .gitattributes
│ config.json
│ README.md
│ tokenizer_config.json
│ vocab.txt
│
├───bert-large-japanese-v2
│ .gitattributes
│ config.json
│ README.md
│ tokenizer_config.json
│ vocab.txt
│
├───chinese-roberta-wwm-ext-large
│ .gitattributes
│ 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
│ .gitattributes
│ config.json
│ pytorch_model.bin
│ README.md
│ special_tokens_map.json
│ tokenizer.json
│ tokenizer_config.json
│
├───deberta-v2-large-japanese-char-wwm
│ .gitattributes
│ config.json
│ pytorch_model.bin
│ README.md
│ special_tokens_map.json
│ tokenizer_config.json
│ vocab.txt
│
└───deberta-v3-large
.gitattributes
config.json
generator_config.json
pytorch_model.bin
README.md
spm.model
tokenizer_config.json
注意,其中每个子目录中的pytorch_model.bin就是bert模型本体。
随后还得下载clap模型,虽然推理已经把clap去掉了,同时下载wav2vec2-large-robust-12-ft-emotion-msp-dim模型,放入到项目的emotional目录:
E:\work\Bert-VITS2-2.3\emotional>tree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
├───clap-htsat-fused
│ .gitattributes
│ config.json
│ merges.txt
│ preprocessor_config.json
│ pytorch_model.bin
│ README.md
│ special_tokens_map.json
│ tokenizer.json
│ tokenizer_config.json
│ vocab.json
│
└───wav2vec2-large-robust-12-ft-emotion-msp-dim
.gitattributes
config.json
LICENSE
preprocessor_config.json
pytorch_model.bin
README.md
vocab.json
最后下载底模:
https://huggingface.co/OedoSoldier/Bert-VITS2-2.3
放入到角色的models目录即可。
请注意这次2.3的底模是4个文件。
Bert-vits2-2.3数据预处理
把艾达王的语音素材放入到Data/ada/raw目录中,执行切分脚本:
python3 audio_slicer.py
会切分成小片素材:
E:\work\Bert-VITS2-2.3\Data\ada\raw>tree /f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
ada_0.wav
ada_1.wav
ada_10.wav
ada_11.wav
ada_12.wav
ada_13.wav
ada_14.wav
ada_15.wav
ada_16.wav
ada_17.wav
ada_18.wav
ada_19.wav
ada_2.wav
ada_20.wav
ada_21.wav
ada_22.wav
ada_23.wav
ada_24.wav
ada_25.wav
ada_26.wav
ada_3.wav
ada_4.wav
ada_5.wav
ada_6.wav
ada_7.wav
ada_8.wav
ada_9.wav
随后运行转写和标注:
python3 short_audio_transcribe.py
程序返回:
E:\work\Bert-VITS2-2.3\venv\lib\site-packages\whisper\timing.py:58: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
def backtrace(trace: np.ndarray):
Data/ada/raw
Detected language: en
I do. The kind you like.
Processed: 1/27
Detected language: en
Now where's the amber?
Processed: 2/27
Detected language: en
Leave the girl. She's lost no matter what.
Processed: 3/27
Detected language: en
You walk away now, and who knows?
Processed: 4/27
Detected language: en
Maybe you'll live to meet me again.
Processed: 5/27
Detected language: en
And I might get you that greeting you were looking for.
Processed: 6/27
Detected language: en
How about we continue this discussion another time?
Processed: 7/27
Detected language: en
Sorry, nothing yet.
Processed: 8/27
Detected language: en
But my little helper is creating
Processed: 9/27
Detected language: en
Quite the commotion.
Processed: 10/27
Detected language: en
Everything will work out just fine.
Processed: 11/27
Detected language: en
He's a good boy. Predictable.
Processed: 12/27
Detected language: en
The deal was, we get you out of here when you deliver the amber. No amber, no protection, Louise.
Processed: 13/27
Detected language: en
Nothing personal, Leon.
Processed: 14/27
Detected language: en
Louise and I had an arrangement.
Processed: 15/27
Detected language: en
Don't worry, I'll take good care of it.
Processed: 16/27
Detected language: en
Just one question.
Processed: 17/27
Detected language: en
What are you planning to do with this?
Processed: 18/27
Detected language: en
So, we're talking millions of casualties?
Processed: 19/27
Detected language: en
We're changing course. Now.
Processed: 20/27
Detected language: en
You can stop right there, Leon.
Processed: 21/27
Detected language: en
wouldn't make me use this.
Processed: 22/27
Detected language: en
Would you? You don't seem surprised.
Processed: 23/27
Detected language: en
Interesting.
Processed: 24/27
Detected language: en
Not a bad move
Processed: 25/27
Detected language: en
Very smooth. Ah, Leon.
Processed: 26/27
Detected language: en
You know I don't work and tell.
注意,这里whiper会报一个警告,如果觉得不好看,可以修改timing.py第58行:
修改前
@numba.jit
def backtrace(trace: np.ndarray):
修改后
@numba.jit(nopython=True)
def backtrace(trace: np.ndarray):
随后,运行web预处理界面:
python3 webui_preprocess.py
随后按照页面提示操作即可:
至此,数据预处理就结束了。
Bert-vits2-2.3训练和推理
在根目录运行命令:
python3 train_ms.py
模型会在models目录生成:
E:\work\Bert-VITS2-2.3\Data\ada\models>tree/f
Folder PATH listing for volume myssd
Volume serial number is 7CE3-15AE
E:.
G_150.pth
随后开启推理页面进行推理即可:
python3 webui.py
新的推理页面增加了使用辅助文本的语意来辅助生成对话(语言保持与主文本相同),即以提示词prompt的形式来定制化生成语音的风格。
但又不能使用使用指令式文本(如:开心),要使用带有强烈情感的文本(如:我好快乐!!!)
这就导致生成的语音情感风格比较玄学:
因为你得不停地调整prompt来测试效果,不如之前地clap情感的audio prompt来的直观,但客观上讲,通过bert语义文本引导的风格化情感语音还是有一定效果的。
结语
更新Bert-vits2系列基础教程的同时,也学习到了很多东西,毫无疑问,Bert-vits2让更多的人领略到了深度学习的魅力,它是一个极其优秀的人工智能入门项目,兴趣永远是最好的老师,与各位共勉,最后奉上Bert-vits2-2.3-Final整合包:
整合包链接:https://pan.baidu.com/s/182LZCu5cyR3nH8EoTBLR-g?pwd=v3uc
与众乡亲同飨。