support gpt sovits v2

ASR languages
git ignore
requirement.txt
more autofill
This commit is contained in:
XXXXRT666 2024-08-02 21:39:38 +08:00 committed by GitHub
parent de7ee7c7c1
commit 73c6244bb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 18 deletions

2
GPT_SoVITS/text/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
G2PWModel
__pycache__

View File

@ -26,4 +26,10 @@ jieba
LangSegment>=0.2.0 LangSegment>=0.2.0
Faster_Whisper Faster_Whisper
wordsegment wordsegment
rotary_embedding_torch rotary_embedding_torch
pyjyutping
g2pk2
ko_pron
opencc
eunjeon; sys_platform == 'win32'
python_mecab_ko; sys_platform != 'win32'

View File

@ -24,7 +24,7 @@ asr_dict = {
'precision': ['float32'] 'precision': ['float32']
}, },
"Faster Whisper (多语种)": { "Faster Whisper (多语种)": {
'lang': ['auto', 'zh', 'en', 'ja'], 'lang': ['auto', 'zh', 'en', 'ja', 'ko', 'yue'],
'size': check_fw_local_models(), 'size': check_fw_local_models(),
'path': 'fasterwhisper_asr.py', 'path': 'fasterwhisper_asr.py',
'precision': ['float32', 'float16', 'int8'] 'precision': ['float32', 'float16', 'int8']

View File

@ -30,4 +30,4 @@ def clean_path(path_str:str):
return clean_path(path_str[0:-1]) return clean_path(path_str[0:-1])
if platform.system() == 'Windows': if platform.system() == 'Windows':
path_str = path_str.replace('/', '\\') path_str = path_str.replace('/', '\\')
return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a") return path_str.strip(" ").strip('\'').strip("\n").strip('"').strip(" ").strip("\u202a")

View File

@ -227,14 +227,14 @@ def open_asr(asr_inp_dir, asr_opt_dir, asr_model, asr_model_size, asr_lang, asr_
output_file_name = os.path.basename(asr_inp_dir) output_file_name = os.path.basename(asr_inp_dir)
output_folder = asr_opt_dir or "output/asr_opt" output_folder = asr_opt_dir or "output/asr_opt"
output_file_path = os.path.abspath(f'{output_folder}/{output_file_name}.list') output_file_path = os.path.abspath(f'{output_folder}/{output_file_name}.list')
yield "ASR任务开启%s"%cmd, {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"} yield "ASR任务开启%s"%cmd, {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"}, {"__type__":"update"}, {"__type__":"update"}
print(cmd) print(cmd)
p_asr = Popen(cmd, shell=True) p_asr = Popen(cmd, shell=True)
p_asr.wait() p_asr.wait()
p_asr=None p_asr=None
yield f"ASR任务完成, 查看终端进行下一步", {"__type__":"update","visible":True}, {"__type__":"update","visible":False}, {"__type__":"update","value":output_file_path} yield f"ASR任务完成, 查看终端进行下一步", {"__type__":"update","visible":True}, {"__type__":"update","visible":False}, {"__type__":"update","value":output_file_path}, {"__type__":"update","value":output_file_path}, {"__type__":"update","value":asr_inp_dir}
else: else:
yield "已有正在进行的ASR任务需先终止才能开启下一次任务", {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"} yield "已有正在进行的ASR任务需先终止才能开启下一次任务", {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"}, {"__type__":"update"}, {"__type__":"update"}
# return None # return None
def close_asr(): def close_asr():
@ -250,14 +250,14 @@ def open_denoise(denoise_inp_dir, denoise_opt_dir):
denoise_opt_dir=my_utils.clean_path(denoise_opt_dir) denoise_opt_dir=my_utils.clean_path(denoise_opt_dir)
cmd = '"%s" tools/cmd-denoise.py -i "%s" -o "%s" -p %s'%(python_exec,denoise_inp_dir,denoise_opt_dir,"float16"if is_half==True else "float32") cmd = '"%s" tools/cmd-denoise.py -i "%s" -o "%s" -p %s'%(python_exec,denoise_inp_dir,denoise_opt_dir,"float16"if is_half==True else "float32")
yield "语音降噪任务开启:%s"%cmd, {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"} yield "语音降噪任务开启:%s"%cmd, {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"}, {"__type__":"update"}
print(cmd) print(cmd)
p_denoise = Popen(cmd, shell=True) p_denoise = Popen(cmd, shell=True)
p_denoise.wait() p_denoise.wait()
p_denoise=None p_denoise=None
yield f"语音降噪任务完成, 查看终端进行下一步", {"__type__":"update","visible":True}, {"__type__":"update","visible":False}, {"__type__":"update","value":denoise_opt_dir} yield f"语音降噪任务完成, 查看终端进行下一步", {"__type__":"update","visible":True}, {"__type__":"update","visible":False}, {"__type__":"update","value":denoise_opt_dir}, {"__type__":"update","value":denoise_opt_dir}
else: else:
yield "已有正在进行的语音降噪任务,需先终止才能开启下一次任务", {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"} yield "已有正在进行的语音降噪任务,需先终止才能开启下一次任务", {"__type__":"update","visible":False}, {"__type__":"update","visible":True}, {"__type__":"update"}, {"__type__":"update"}
# return None # return None
def close_denoise(): def close_denoise():
@ -377,13 +377,13 @@ def open_slice(inp,opt_root,threshold,min_length,min_interval,hop_size,max_sil_k
print(cmd) print(cmd)
p = Popen(cmd, shell=True) p = Popen(cmd, shell=True)
ps_slice.append(p) ps_slice.append(p)
yield "切割执行中", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True}, {"__type__": "update"}, {"__type__": "update"} yield "切割执行中", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True}, {"__type__": "update"}, {"__type__": "update"}, {"__type__": "update"}
for p in ps_slice: for p in ps_slice:
p.wait() p.wait()
ps_slice=[] ps_slice=[]
yield "切割结束", {"__type__":"update","visible":True}, {"__type__":"update","visible":False}, {"__type__": "update", "value":opt_root}, {"__type__": "update", "value":opt_root} yield "切割结束", {"__type__":"update","visible":True}, {"__type__":"update","visible":False}, {"__type__": "update", "value":opt_root}, {"__type__": "update", "value":opt_root}, {"__type__": "update", "value":opt_root}
else: else:
yield "已有正在进行的切割任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True}, {"__type__": "update"}, {"__type__": "update"} yield "已有正在进行的切割任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True}, {"__type__": "update"}, {"__type__": "update"}, {"__type__": "update"}
def close_slice(): def close_slice():
global ps_slice global ps_slice
@ -818,12 +818,6 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
label_info = gr.Textbox(label=i18n("打标工具进程输出信息")) label_info = gr.Textbox(label=i18n("打标工具进程输出信息"))
if_label.change(change_label, [if_label,path_list], [label_info]) if_label.change(change_label, [if_label,path_list], [label_info])
if_uvr5.change(change_uvr5, [if_uvr5], [uvr5_info]) if_uvr5.change(change_uvr5, [if_uvr5], [uvr5_info])
open_asr_button.click(open_asr, [asr_inp_dir, asr_opt_dir, asr_model, asr_size, asr_lang, asr_precision], [asr_info,open_asr_button,close_asr_button,path_list])
close_asr_button.click(close_asr, [], [asr_info,open_asr_button,close_asr_button])
open_slicer_button.click(open_slice, [slice_inp_path,slice_opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_max,alpha,n_process], [slicer_info,open_slicer_button,close_slicer_button,asr_inp_dir,denoise_input_dir])
close_slicer_button.click(close_slice, [], [slicer_info,open_slicer_button,close_slicer_button])
open_denoise_button.click(open_denoise, [denoise_input_dir,denoise_output_dir], [denoise_info,open_denoise_button,close_denoise_button,asr_inp_dir])
close_denoise_button.click(close_denoise, [], [denoise_info,open_denoise_button,close_denoise_button])
with gr.TabItem(i18n("1-GPT-SoVITS-TTS")): with gr.TabItem(i18n("1-GPT-SoVITS-TTS")):
with gr.Row(): with gr.Row():
@ -867,6 +861,14 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
button1abc_open = gr.Button(i18n("开启一键三连"), variant="primary",visible=True) button1abc_open = gr.Button(i18n("开启一键三连"), variant="primary",visible=True)
button1abc_close = gr.Button(i18n("终止一键三连"), variant="primary",visible=False) button1abc_close = gr.Button(i18n("终止一键三连"), variant="primary",visible=False)
info1abc=gr.Textbox(label=i18n("一键三连进程输出信息")) info1abc=gr.Textbox(label=i18n("一键三连进程输出信息"))
open_asr_button.click(open_asr, [asr_inp_dir, asr_opt_dir, asr_model, asr_size, asr_lang, asr_precision], [asr_info,open_asr_button,close_asr_button,path_list,inp_text,inp_wav_dir])
close_asr_button.click(close_asr, [], [asr_info,open_asr_button,close_asr_button])
open_slicer_button.click(open_slice, [slice_inp_path,slice_opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_max,alpha,n_process], [slicer_info,open_slicer_button,close_slicer_button,asr_inp_dir,denoise_input_dir,inp_wav_dir])
close_slicer_button.click(close_slice, [], [slicer_info,open_slicer_button,close_slicer_button])
open_denoise_button.click(open_denoise, [denoise_input_dir,denoise_output_dir], [denoise_info,open_denoise_button,close_denoise_button,asr_inp_dir,inp_wav_dir])
close_denoise_button.click(close_denoise, [], [denoise_info,open_denoise_button,close_denoise_button])
button1a_open.click(open1a, [inp_text,inp_wav_dir,exp_name,gpu_numbers1a,bert_pretrained_dir], [info1a,button1a_open,button1a_close]) button1a_open.click(open1a, [inp_text,inp_wav_dir,exp_name,gpu_numbers1a,bert_pretrained_dir], [info1a,button1a_open,button1a_close])
button1a_close.click(close1a, [], [info1a,button1a_open,button1a_close]) button1a_close.click(close1a, [], [info1a,button1a_open,button1a_close])
button1b_open.click(open1b, [inp_text,inp_wav_dir,exp_name,gpu_numbers1Ba,cnhubert_base_dir], [info1b,button1b_open,button1b_close]) button1b_open.click(open1b, [inp_text,inp_wav_dir,exp_name,gpu_numbers1Ba,cnhubert_base_dir], [info1b,button1b_open,button1b_close])