This commit is contained in:
XXXXRT666 2024-08-06 20:05:20 +08:00
parent 36a12038c7
commit 7f8b42150a
2 changed files with 17 additions and 9 deletions

View File

@ -0,0 +1,5 @@
import os, sys
now_dir = os.getcwd()
sys.path.insert(0, now_dir)
from text.g2pw import G2PWPinyin
g2pw = G2PWPinyin(model_dir="GPT_SoVITS/text/G2PWModel",model_source="GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large",v_to_u=False, neutral_tone_with_five=True)

View File

@ -440,7 +440,7 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir):
global ps1a global ps1a
inp_text = my_utils.clean_path(inp_text) inp_text = my_utils.clean_path(inp_text)
inp_wav_dir = my_utils.clean_path(inp_wav_dir) inp_wav_dir = my_utils.clean_path(inp_wav_dir)
check_for_exists([inp_text,inp_wav_dir]) check_for_exists([inp_text,inp_wav_dir], is_dataset_processing=True)
if (ps1a == []): if (ps1a == []):
opt_dir="%s/%s"%(exp_root,exp_name) opt_dir="%s/%s"%(exp_root,exp_name)
config={ config={
@ -502,7 +502,7 @@ def open1b(inp_text,inp_wav_dir,exp_name,gpu_numbers,ssl_pretrained_dir):
global ps1b global ps1b
inp_text = my_utils.clean_path(inp_text) inp_text = my_utils.clean_path(inp_text)
inp_wav_dir = my_utils.clean_path(inp_wav_dir) inp_wav_dir = my_utils.clean_path(inp_wav_dir)
check_for_exists([inp_text,inp_wav_dir]) check_for_exists([inp_text,inp_wav_dir], is_dataset_processing=True)
if (ps1b == []): if (ps1b == []):
config={ config={
"inp_text":inp_text, "inp_text":inp_text,
@ -550,7 +550,7 @@ ps1c=[]
def open1c(inp_text,exp_name,gpu_numbers,pretrained_s2G_path): def open1c(inp_text,exp_name,gpu_numbers,pretrained_s2G_path):
global ps1c global ps1c
inp_text = my_utils.clean_path(inp_text) inp_text = my_utils.clean_path(inp_text)
check_for_exists([inp_text]) check_for_exists([inp_text,''], is_dataset_processing=True)
if (ps1c == []): if (ps1c == []):
opt_dir="%s/%s"%(exp_root,exp_name) opt_dir="%s/%s"%(exp_root,exp_name)
config={ config={
@ -746,7 +746,7 @@ def switch_version(version_):
gr.Warning(i18n(f'未下载{version.upper()}模型')) gr.Warning(i18n(f'未下载{version.upper()}模型'))
return {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2].replace("s2G","s2D")}, {'__type__':'update', 'value':pretrained_gpt_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_gpt_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2]} return {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2].replace("s2G","s2D")}, {'__type__':'update', 'value':pretrained_gpt_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_gpt_name[-int(version[-1])+2]}, {'__type__':'update', 'value':pretrained_sovits_name[-int(version[-1])+2]}
def check_for_exists(file_list=None,is_train=False): def check_for_exists(file_list=None,is_train=False,is_dataset_processing=False):
missing_files=[] missing_files=[]
if is_train == True and file_list: if is_train == True and file_list:
file_list.append(os.path.join(file_list[0],'2-name2text.txt')) file_list.append(os.path.join(file_list[0],'2-name2text.txt'))
@ -767,12 +767,15 @@ def check_for_exists(file_list=None,is_train=False):
for missing_file in missing_files: for missing_file in missing_files:
if missing_file != '': if missing_file != '':
gr.Warning(missing_file) gr.Warning(missing_file)
gr.Warning(i18n('以下文件或文件夹不存在:')) if file_list[-1]==[''] and is_dataset_processing:
pass
else:
from GPT_SoVITS.text.g2pw import G2PWPinyin gr.Warning(i18n('以下文件或文件夹不存在:'))
g2pw = G2PWPinyin(model_dir="GPT_SoVITS/text/G2PWModel",model_source="GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large",v_to_u=False, neutral_tone_with_five=True)
cmd = '"%s" GPT_SoVITS/g2pw_download'%python_exec
print(cmd)
p = Popen(cmd, shell=True)
p.wait()
with gr.Blocks(title="GPT-SoVITS WebUI") as app: with gr.Blocks(title="GPT-SoVITS WebUI") as app:
gr.Markdown( gr.Markdown(