Simon Shi的小站

人工智能,机器学习, 强化学习,大模型,自动驾驶

0%

GPT_SoVITS SOP

CODE: https://github.com/RVC-Boss/GPT-SoVITS

DOCEKR https://hub.docker.com/r/breakstring/gpt-sovits/tags

Docs: https://qqk9ntwbcit.feishu.cn/wiki/SdJDwjaYFifxAhkFJVic9u5hn6c

# 3分钟素材!30分钟搞定!使用GPT-SoVITS训练自己的语音模型

CodeWithGPU | 能复现才是好算法

1 前置数据集获取

  • mp3/wav 数据分片

  • 语音降噪

  • 离线ASR(音频标注文本)

  • 打标对比工具

2 TTS

2.A 训练集格式化

2.A.1 开启文本提取

    “/usr/local/bin/python” GPT_SoVITS/prepare_datasets/1-get-text.py

2.A.2 SSL自监督特征提取

    “/usr/local/bin/python” GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py

2.A.3 语义token提取

    “/usr/local/bin/python” GPT_SoVITS/prepare_datasets/3-get-semantic.py

2.B FineTune

1、 SoVITS训练

1
"/usr/local/bin/python" GPT_SoVITS/s2_train.py --config "/databig/ddz/sdiffusion/GPT-SoVITS/TEMP/tmp_s2.json"

2、GPT训练

1
"/usr/local/bin/python" GPT_SoVITS/s1_train.py --config_file "/databig/ddz/sdiffusion/GPT-SoVITS/TEMP/tmp_s1.yaml"

2.C 推理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def change_tts_inference(bert_path,cnhubert_base_path,gpu_number,gpt_path,sovits_path, batched_infer_enabled):
global p_tts_inference
if batched_infer_enabled:
cmd = '"%s" GPT_SoVITS/inference_webui_fast.py "%s"'%(python_exec, language)
else:
cmd = '"%s" GPT_SoVITS/inference_webui.py "%s"'%(python_exec, language)
if(p_tts_inference==None):
os.environ["gpt_path"]=gpt_path if "/" in gpt_path else "%s/%s"%(GPT_weight_root,gpt_path)
os.environ["sovits_path"]=sovits_path if "/"in sovits_path else "%s/%s"%(SoVITS_weight_root,sovits_path)
os.environ["cnhubert_base_path"]=cnhubert_base_path
os.environ["bert_path"]=bert_path
os.environ["_CUDA_VISIBLE_DEVICES"]=fix_gpu_number(gpu_number)
os.environ["is_half"]=str(is_half)
os.environ["infer_ttswebui"]=str(webui_port_infer_tts)
os.environ["is_share"]=str(is_share)
yield i18n("TTS推理进程已开启"), {'__type__':'update','visible':False}, {'__type__':'update','visible':True}
print(cmd)
p_tts_inference = Popen(cmd, shell=True)
elif(p_tts_inference!=None):
kill_process(p_tts_inference.pid)
p_tts_inference=None
yield i18n("TTS推理进程已关闭"), {'__type__':'update','visible':True}, {'__type__':'update','visible':False}

webUI

BUG

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  File "/usr/local/lib/python3.9/site-packages/opencc/__init__.py", line 7, in <module>
import opencc_clib
ModuleNotFoundError: No module named 'opencc_clib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/databig/ddz/sdiffusion/GPT-SoVITS/GPT_SoVITS/prepare_datasets/1-get-text.py", line 92, in process
phones, word2ph, norm_text = clean_text(
File "/databig/ddz/sdiffusion/GPT-SoVITS/GPT_SoVITS/text/cleaner.py", line 36, in clean_text
language_module = __import__("text."+language_module_map[language],fromlist=[language_module_map[language]])
File "/databig/ddz/sdiffusion/GPT-SoVITS/GPT_SoVITS/text/chinese2.py", line 28, in <module>
from text.g2pw import G2PWPinyin, correct_pronunciation
File "/databig/ddz/sdiffusion/GPT-SoVITS/GPT_SoVITS/text/g2pw/__init__.py", line 1, in <module>
from text.g2pw.g2pw import *
File "/databig/ddz/sdiffusion/GPT-SoVITS/GPT_SoVITS/text/g2pw/g2pw.py", line 11, in <module>
from .onnx_api import G2PWOnnxConverter
File "/databig/ddz/sdiffusion/GPT-SoVITS/GPT_SoVITS/text/g2pw/onnx_api.py", line 17, in <module>
from opencc import OpenCC
File "/usr/local/lib/python3.9/site-packages/opencc/__init__.py", line 9, in <module>
from opencc.clib import opencc_clib
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/local/lib/python3.9/site-packages/opencc/clib/opencc_clib.cpython-39-x86_64-linux-gnu.so)


fix

1
pip install opencc-python-reimplemented