From 5c60ad634c4db1b9bcaca72108c95bdbc5f0330c Mon Sep 17 00:00:00 2001 From: Rice Cake Date: Mon, 22 Jan 2024 20:21:29 +0800 Subject: [PATCH 1/5] Add files via upload --- webui.py | 118 ++++++++++++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 63 deletions(-) diff --git a/webui.py b/webui.py index 60c6e1b..e23353c 100644 --- a/webui.py +++ b/webui.py @@ -1,22 +1,16 @@ -import os,shutil,sys,pdb -now_dir = os.getcwd() -sys.path.append(now_dir) import json,yaml,warnings,torch import platform import psutil +import os import signal warnings.filterwarnings("ignore") torch.manual_seed(233333) +import os,pdb,sys +now_dir = os.getcwd() tmp = os.path.join(now_dir, "TEMP") os.makedirs(tmp, exist_ok=True) os.environ["TEMP"] = tmp -if(os.path.exists(tmp)): - for name in os.listdir(tmp): - if(name=="jieba.cache"):continue - path="%s/%s"%(tmp,name) - delete=os.remove if os.path.isfile(path) else shutil.rmtree - delete(path) import site site_packages_roots = [] for path in site.getsitepackages(): @@ -32,15 +26,15 @@ for site_packages_root in site_packages_roots: "%s\n%s/tools\n%s/tools/damo_asr\n%s/GPT_SoVITS\n%s/tools/uvr5" % (now_dir, now_dir, now_dir, now_dir, now_dir) ) -from tools import my_utils import traceback +sys.path.append(now_dir) import shutil import pdb import gradio as gr from subprocess import Popen import signal -from config import python_exec,infer_device,is_half,exp_root,webui_port_main,webui_port_infer_tts,webui_port_uvr5,webui_port_subfix,is_share -from tools.i18n.i18n import I18nAuto +from config import python_exec,infer_device,is_half,exp_root,webui_port_main,webui_port_infer_tts,webui_port_uvr5,webui_port_subfix +from i18n.i18n import I18nAuto i18n = I18nAuto() from scipy.io import wavfile from tools.my_utils import load_audio @@ -125,7 +119,7 @@ def kill_process(pid): def change_label(if_label,path_list): global p_label if(if_label==True and p_label==None): - cmd = '"%s" tools/subfix_webui.py --load_list "%s" --webui_port %s --is_share %s'%(python_exec,path_list,webui_port_subfix,is_share) + cmd = '"%s" tools/subfix_webui.py --load_list "%s" --webui_port %s'%(python_exec,path_list,webui_port_subfix) yield i18n("打标工具WebUI已开启") print(cmd) p_label = Popen(cmd, shell=True) @@ -137,7 +131,7 @@ def change_label(if_label,path_list): def change_uvr5(if_uvr5): global p_uvr5 if(if_uvr5==True and p_uvr5==None): - cmd = '"%s" tools/uvr5/webui.py "%s" %s %s %s'%(python_exec,infer_device,is_half,webui_port_uvr5,is_share) + cmd = '"%s" tools/uvr5/webui.py "%s" %s %s'%(python_exec,infer_device,is_half,webui_port_uvr5) yield i18n("UVR5已开启") print(cmd) p_uvr5 = Popen(cmd, shell=True) @@ -156,7 +150,6 @@ def change_tts_inference(if_tts,bert_path,cnhubert_base_path,gpu_number,gpt_path os.environ["_CUDA_VISIBLE_DEVICES"]=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) cmd = '"%s" GPT_SoVITS/inference_webui.py'%(python_exec) yield i18n("TTS推理进程已开启") print(cmd) @@ -171,21 +164,21 @@ def open_asr(asr_inp_dir): global p_asr if(p_asr==None): cmd = '"%s" tools/damo_asr/cmd-asr.py "%s"'%(python_exec,asr_inp_dir) - yield "ASR任务开启:%s"%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} + yield i18n("ASR任务开启:%s")%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} print(cmd) p_asr = Popen(cmd, shell=True) p_asr.wait() p_asr=None - yield "ASR任务完成",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("ASR任务完成"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的ASR任务,需先终止才能开启下一次任务",{"__type__":"update","visible":False},{"__type__":"update","visible":True} + yield i18n("已有正在进行的ASR任务,需先终止才能开启下一次任务"),{"__type__":"update","visible":False},{"__type__":"update","visible":True} def close_asr(): global p_asr if(p_asr!=None): kill_process(p_asr.pid) p_asr=None - return "已终止ASR进程",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + return i18n("已终止ASR进程"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} p_train_SoVITS=None def open1Ba(batch_size,total_epoch,exp_name,text_low_lr_rate,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers1Ba,pretrained_s2G,pretrained_s2D): @@ -212,21 +205,21 @@ def open1Ba(batch_size,total_epoch,exp_name,text_low_lr_rate,if_save_latest,if_s with open(tmp_config_path,"w")as f:f.write(json.dumps(data)) cmd = '"%s" GPT_SoVITS/s2_train.py --config "%s"'%(python_exec,tmp_config_path) - yield "SoVITS训练开始:%s"%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} + yield i18n("SoVITS训练开始:%s")%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} print(cmd) p_train_SoVITS = Popen(cmd, shell=True) p_train_SoVITS.wait() p_train_SoVITS=None - yield "SoVITS训练完成",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("SoVITS训练完成"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的SoVITS训练任务,需先终止才能开启下一次任务",{"__type__":"update","visible":False},{"__type__":"update","visible":True} + yield i18n("已有正在进行的SoVITS训练任务,需先终止才能开启下一次任务"),{"__type__":"update","visible":False},{"__type__":"update","visible":True} def close1Ba(): global p_train_SoVITS if(p_train_SoVITS!=None): kill_process(p_train_SoVITS.pid) p_train_SoVITS=None - return "已终止SoVITS训练",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + return i18n("已终止SoVITS训练"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} p_train_GPT=None def open1Bb(batch_size,total_epoch,exp_name,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers,pretrained_s1): @@ -255,34 +248,32 @@ def open1Bb(batch_size,total_epoch,exp_name,if_save_latest,if_save_every_weights with open(tmp_config_path, "w") as f:f.write(yaml.dump(data, default_flow_style=False)) # cmd = '"%s" GPT_SoVITS/s1_train.py --config_file "%s" --train_semantic_path "%s/6-name2semantic.tsv" --train_phoneme_path "%s/2-name2text.txt" --output_dir "%s/logs_s1"'%(python_exec,tmp_config_path,s1_dir,s1_dir,s1_dir) cmd = '"%s" GPT_SoVITS/s1_train.py --config_file "%s" '%(python_exec,tmp_config_path) - yield "GPT训练开始:%s"%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} + yield i18n("GPT训练开始:%s")%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True} print(cmd) p_train_GPT = Popen(cmd, shell=True) p_train_GPT.wait() p_train_GPT=None - yield "GPT训练完成",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("GPT训练完成"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的GPT训练任务,需先终止才能开启下一次任务",{"__type__":"update","visible":False},{"__type__":"update","visible":True} + yield i18n("已有正在进行的GPT训练任务,需先终止才能开启下一次任务"),{"__type__":"update","visible":False},{"__type__":"update","visible":True} def close1Bb(): global p_train_GPT if(p_train_GPT!=None): kill_process(p_train_GPT.pid) p_train_GPT=None - return "已终止GPT训练",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + return i18n("已终止GPT训练"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} ps_slice=[] def open_slice(inp,opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_max,alpha,n_parts): global ps_slice - inp = my_utils.clean_path(inp) - opt_root = my_utils.clean_path(opt_root) if(os.path.exists(inp)==False): - yield "输入路径不存在",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("输入路径不存在"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} return if os.path.isfile(inp):n_parts=1 elif os.path.isdir(inp):pass else: - yield "输入路径存在但既不是文件也不是文件夹",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("输入路径存在但既不是文件也不是文件夹"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} return if (ps_slice == []): for i_part in range(n_parts): @@ -290,13 +281,13 @@ def open_slice(inp,opt_root,threshold,min_length,min_interval,hop_size,max_sil_k print(cmd) p = Popen(cmd, shell=True) ps_slice.append(p) - yield "切割执行中", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("切割执行中"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps_slice: p.wait() ps_slice=[] - yield "切割结束",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("切割结束"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的切割任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("已有正在进行的切割任务,需先终止才能开启下一次任务"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} def close_slice(): global ps_slice @@ -307,7 +298,7 @@ def close_slice(): except: traceback.print_exc() ps_slice=[] - return "已终止所有切割进程", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + return i18n("已终止所有切割进程"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} ps1a=[] def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir): @@ -337,7 +328,7 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir): print(cmd) p = Popen(cmd, shell=True) ps1a.append(p) - yield "文本进程执行中", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("文本进程执行中"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps1a: p.wait() opt = [] @@ -350,9 +341,9 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir): with open(path_text, "w", encoding="utf8") as f: f.write("\n".join(opt) + "\n") ps1a=[] - yield "文本进程结束",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("文本进程结束"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的文本任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("已有正在进行的文本任务,需先终止才能开启下一次任务"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} def close1a(): global ps1a @@ -363,7 +354,7 @@ def close1a(): except: traceback.print_exc() ps1a=[] - return "已终止所有1a进程", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + return i18n("已终止所有1a进程"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} ps1b=[] def open1b(inp_text,inp_wav_dir,exp_name,gpu_numbers,ssl_pretrained_dir): @@ -392,13 +383,13 @@ def open1b(inp_text,inp_wav_dir,exp_name,gpu_numbers,ssl_pretrained_dir): print(cmd) p = Popen(cmd, shell=True) ps1b.append(p) - yield "SSL提取进程执行中", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("SSL提取进程执行中"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps1b: p.wait() ps1b=[] - yield "SSL提取进程结束",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("SSL提取进程结束"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的SSL提取任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("已有正在进行的SSL提取任务,需先终止才能开启下一次任务"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} def close1b(): global ps1b @@ -409,7 +400,7 @@ def close1b(): except: traceback.print_exc() ps1b=[] - return "已终止所有1b进程", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + return i18n("已终止所有1b进程"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} ps1c=[] def open1c(inp_text,exp_name,gpu_numbers,pretrained_s2G_path): @@ -439,7 +430,7 @@ def open1c(inp_text,exp_name,gpu_numbers,pretrained_s2G_path): print(cmd) p = Popen(cmd, shell=True) ps1c.append(p) - yield "语义token提取进程执行中", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("语义token提取进程执行中"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps1c: p.wait() opt = ["item_name semantic_audio"] @@ -452,9 +443,9 @@ def open1c(inp_text,exp_name,gpu_numbers,pretrained_s2G_path): with open(path_semantic, "w", encoding="utf8") as f: f.write("\n".join(opt) + "\n") ps1c=[] - yield "语义token提取进程结束",{"__type__":"update","visible":True},{"__type__":"update","visible":False} + yield i18n("语义token提取进程结束"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} else: - yield "已有正在进行的语义token提取任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("已有正在进行的语义token提取任务,需先终止才能开启下一次任务"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} def close1c(): global ps1c @@ -465,7 +456,7 @@ def close1c(): except: traceback.print_exc() ps1c=[] - return "已终止所有语义token进程", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + return i18n("已终止所有语义token进程"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} #####inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numbers1c,bert_pretrained_dir,cnhubert_base_dir,pretrained_s2G ps1abc=[] def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numbers1c,bert_pretrained_dir,ssl_pretrained_dir,pretrained_s2G_path): @@ -499,7 +490,7 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb print(cmd) p = Popen(cmd, shell=True) ps1abc.append(p) - yield "进度:1a-ing", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("进度:1a-ing"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps1abc:p.wait() opt = [] @@ -511,7 +502,7 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb with open(path_text, "w",encoding="utf8") as f: f.write("\n".join(opt) + "\n") - yield "进度:1a-done", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("进度:1a-done"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} ps1abc=[] #############################1b config={ @@ -536,9 +527,9 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb print(cmd) p = Popen(cmd, shell=True) ps1abc.append(p) - yield "进度:1a-done, 1b-ing", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("进度:1a-done, 1b-ing"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps1abc:p.wait() - yield "进度:1a1b-done", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("进度:1a1b-done"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} ps1abc=[] #############################1c path_semantic = "%s/6-name2semantic.tsv" % opt_dir @@ -565,7 +556,7 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb print(cmd) p = Popen(cmd, shell=True) ps1abc.append(p) - yield "进度:1a1b-done, 1cing", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("进度:1a1b-done, 1cing"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} for p in ps1abc:p.wait() opt = ["item_name semantic_audio"] @@ -576,15 +567,15 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb os.remove(semantic_path) with open(path_semantic, "w",encoding="utf8") as f: f.write("\n".join(opt) + "\n") - yield "进度:all-done", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("进度:all-done"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} ps1abc = [] - yield "一键三连进程结束", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + yield i18n("一键三连进程结束"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} except: traceback.print_exc() close1abc() - yield "一键三连中途报错", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + yield i18n("一键三连中途报错"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} else: - yield "已有正在进行的一键三连任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} + yield i18n("已有正在进行的一键三连任务,需先终止才能开启下一次任务"), {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True} def close1abc(): global ps1abc @@ -595,12 +586,13 @@ def close1abc(): except: traceback.print_exc() ps1abc=[] - return "已终止所有一键三连进程", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} + return i18n("已终止所有一键三连进程"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} with gr.Blocks(title="GPT-SoVITS WebUI") as app: gr.Markdown( - value= + value=i18n( i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.
如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录LICENSE.") + ) ) with gr.Tabs(): with gr.TabItem(i18n("0-前置数据集获取工具")):#提前随机切片防止uvr5爆内存->uvr5->slicer->asr->打标 @@ -650,7 +642,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: 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]) close_slicer_button.click(close_slice, [], [slicer_info,open_slicer_button,close_slicer_button]) - with gr.TabItem(i18n("1-GPT-SoVITS-TTS")): + with gr.TabItem("1-GPT-SoVITS-TTS"): with gr.Row(): exp_name = gr.Textbox(label=i18n("*实验/模型名"), value="xxx", interactive=True) gpu_info = gr.Textbox(label=i18n("显卡信息"), value=gpu_info, visible=True, interactive=False) @@ -665,9 +657,9 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: label=i18n("*训练集音频文件目录"), # value=r"D:\RVC1006\GPT-SoVITS\raw\xxx", interactive=True, - placeholder=i18n("训练集音频文件目录-拼接-list文件里波形对应的文件名(不是全路径)。") + placeholder=i18n("训练集音频文件目录 拼接 list文件里波形对应的文件名。") ) - gr.Markdown(value=i18n("1Aa-文本内容")) + gr.Markdown(value="1Aa-文本内容") with gr.Row(): gpu_numbers1a = gr.Textbox(label=i18n("GPU卡号以-分割,每个卡号一个进程"),value="%s-%s"%(gpus,gpus),interactive=True) bert_pretrained_dir = gr.Textbox(label=i18n("预训练的中文BERT模型路径"),value="GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large",interactive=False) @@ -705,7 +697,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: with gr.Row(): batch_size = gr.Slider(minimum=1,maximum=40,step=1,label=i18n("每张显卡的batch_size"),value=default_batch_size,interactive=True) total_epoch = gr.Slider(minimum=1,maximum=20,step=1,label=i18n("总训练轮数total_epoch,不建议太高"),value=8,interactive=True) - text_low_lr_rate = gr.Slider(minimum=0.2,maximum=0.6,step=0.05,label=i18n("文本模块学习率权重"),value=0.4,interactive=True) + text_low_lr_rate = gr.Slider(minimum=0.2,maximum=0.6,step=0.05,label="文本模块学习率权重",value=0.4,interactive=True) save_every_epoch = gr.Slider(minimum=1,maximum=50,step=1,label=i18n("保存频率save_every_epoch"),value=4,interactive=True) if_save_latest = gr.Checkbox(label=i18n("是否仅保存最新的ckpt文件以节省硬盘空间"), value=True, interactive=True, show_label=True) if_save_every_weights = gr.Checkbox(label=i18n("是否在每次保存时间点将最终小模型保存至weights文件夹"), value=True, interactive=True, show_label=True) @@ -746,7 +738,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: app.queue(concurrency_count=511, max_size=1022).launch( server_name="0.0.0.0", inbrowser=True, - share=is_share, + share=True, server_port=webui_port_main, quiet=True, ) From 191f27f699f53d6f27e1f6f74c2f36371730b773 Mon Sep 17 00:00:00 2001 From: Rice Cake Date: Mon, 22 Jan 2024 20:24:45 +0800 Subject: [PATCH 2/5] Add files via upload --- i18n/locale/en_US.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18n/locale/en_US.json b/i18n/locale/en_US.json index 160f103..b7ea99a 100644 --- a/i18n/locale/en_US.json +++ b/i18n/locale/en_US.json @@ -3,7 +3,7 @@ "UVR5已开启": "UVR5 opened ", "UVR5已关闭": "UVR5 closed", "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.
如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录LICENSE.": "This software is open source under the MIT license. The author does not have any control over the software. Users who use the software and distribute the sounds exported by the software are solely responsible.
If you do not agree with this clause, you cannot use or reference any codes and files within the software package. See the root directory Agreement-LICENSE.txt for details.", - "0-前置数据集获取工具": "0-Fech dataset", + "0-前置数据集获取工具": "0-Fetch dataset", "0a-UVR5人声伴奏分离&去混响去延迟工具": "0a-UVR5 webui (for vocal separation, deecho, dereverb and denoise)", "是否开启UVR5-WebUI": "Open UVR5-WebUI", "UVR5进程输出信息": "UVR5 process output log", @@ -128,7 +128,7 @@ "已终止所有一键三连进程": "All one-clicking formatting tasks has been stopped", "已终止所有切割进程": "All audio slicing tasks has been stopped", "已终止所有语义token进程": "All semantics token tasks has been stopped", - "按中文句号。切": "按中文句号。切", + "按中文句号。切": "Slice by Chinese punct", "文本切分工具。太长的文本合成出来效果不一定好,所以太长建议先切。合成会根据文本的换行分开合成再拼起来。": "Text slicer tool, since there will be issues when infering long texts, so it is advised to cut first. When infering, it will infer respectively then combined together.", "文本进程执行中": "Text processing", "文本进程结束": "Finished text processing", From 40603d00c2d37df2f170a1519e3e1a594a8702b4 Mon Sep 17 00:00:00 2001 From: Rice Cake Date: Mon, 22 Jan 2024 20:25:13 +0800 Subject: [PATCH 3/5] Add files via upload --- tools/uvr5/webui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/uvr5/webui.py b/tools/uvr5/webui.py index 1ede1b4..71e7ebc 100644 --- a/tools/uvr5/webui.py +++ b/tools/uvr5/webui.py @@ -119,7 +119,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format with gr.Blocks(title="RVC WebUI") as app: gr.Markdown( value= - "本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.
如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录LICENSE." + i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.
如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录LICENSE.") ) with gr.Tabs(): with gr.TabItem(i18n("伴奏人声分离&去混响&去回声")): @@ -144,7 +144,7 @@ with gr.Blocks(title="RVC WebUI") as app: minimum=0, maximum=20, step=1, - label="人声提取激进程度", + label=i18n("人声提取激进程度"), value=10, interactive=True, visible=False, # 先不开放调整 From 20e7be87c6d8a7a6375681f954048b80a2dcf889 Mon Sep 17 00:00:00 2001 From: Rice Cake Date: Mon, 22 Jan 2024 20:35:46 +0800 Subject: [PATCH 4/5] Add files via upload --- webui.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/webui.py b/webui.py index e23353c..4eaf901 100644 --- a/webui.py +++ b/webui.py @@ -1,3 +1,6 @@ +import os,shutil,sys,pdb +now_dir = os.getcwd() +sys.path.append(now_dir) import json,yaml,warnings,torch import platform import psutil @@ -11,6 +14,12 @@ now_dir = os.getcwd() tmp = os.path.join(now_dir, "TEMP") os.makedirs(tmp, exist_ok=True) os.environ["TEMP"] = tmp +if(os.path.exists(tmp)): + for name in os.listdir(tmp): + if(name=="jieba.cache"):continue + path="%s/%s"%(tmp,name) + delete=os.remove if os.path.isfile(path) else shutil.rmtree + delete(path) import site site_packages_roots = [] for path in site.getsitepackages(): @@ -26,14 +35,14 @@ for site_packages_root in site_packages_roots: "%s\n%s/tools\n%s/tools/damo_asr\n%s/GPT_SoVITS\n%s/tools/uvr5" % (now_dir, now_dir, now_dir, now_dir, now_dir) ) +from tools import my_utils import traceback -sys.path.append(now_dir) import shutil import pdb import gradio as gr from subprocess import Popen import signal -from config import python_exec,infer_device,is_half,exp_root,webui_port_main,webui_port_infer_tts,webui_port_uvr5,webui_port_subfix +from config import python_exec,infer_device,is_half,exp_root,webui_port_main,webui_port_infer_tts,webui_port_uvr5,webui_port_subfix,is_share from i18n.i18n import I18nAuto i18n = I18nAuto() from scipy.io import wavfile @@ -119,7 +128,7 @@ def kill_process(pid): def change_label(if_label,path_list): global p_label if(if_label==True and p_label==None): - cmd = '"%s" tools/subfix_webui.py --load_list "%s" --webui_port %s'%(python_exec,path_list,webui_port_subfix) + cmd = '"%s" tools/subfix_webui.py --load_list "%s" --webui_port %s --is_share %s'%(python_exec,path_list,webui_port_subfix,is_share) yield i18n("打标工具WebUI已开启") print(cmd) p_label = Popen(cmd, shell=True) @@ -131,7 +140,7 @@ def change_label(if_label,path_list): def change_uvr5(if_uvr5): global p_uvr5 if(if_uvr5==True and p_uvr5==None): - cmd = '"%s" tools/uvr5/webui.py "%s" %s %s'%(python_exec,infer_device,is_half,webui_port_uvr5) + cmd = '"%s" tools/uvr5/webui.py "%s" %s %s %s'%(python_exec,infer_device,is_half,webui_port_uvr5,is_share) yield i18n("UVR5已开启") print(cmd) p_uvr5 = Popen(cmd, shell=True) @@ -150,6 +159,7 @@ def change_tts_inference(if_tts,bert_path,cnhubert_base_path,gpu_number,gpt_path os.environ["_CUDA_VISIBLE_DEVICES"]=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) cmd = '"%s" GPT_SoVITS/inference_webui.py'%(python_exec) yield i18n("TTS推理进程已开启") print(cmd) @@ -267,6 +277,8 @@ def close1Bb(): ps_slice=[] def open_slice(inp,opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_max,alpha,n_parts): global ps_slice + inp = my_utils.clean_path(inp) + opt_root = my_utils.clean_path(opt_root) if(os.path.exists(inp)==False): yield i18n("输入路径不存在"),{"__type__":"update","visible":True},{"__type__":"update","visible":False} return @@ -588,11 +600,10 @@ def close1abc(): ps1abc=[] return i18n("已终止所有一键三连进程"), {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False} -with gr.Blocks(title="GPT-SoVITS WebUI") as app: +with gr.Blocks(title=i18n("GPT-SoVITS WebUI")) as app: gr.Markdown( - value=i18n( + value= i18n("本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责.
如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录LICENSE.") - ) ) with gr.Tabs(): with gr.TabItem(i18n("0-前置数据集获取工具")):#提前随机切片防止uvr5爆内存->uvr5->slicer->asr->打标 @@ -657,9 +668,9 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: label=i18n("*训练集音频文件目录"), # value=r"D:\RVC1006\GPT-SoVITS\raw\xxx", interactive=True, - placeholder=i18n("训练集音频文件目录 拼接 list文件里波形对应的文件名。") + placeholder=i18n("训练集音频文件目录-拼接-list文件里波形对应的文件名(不是全路径)。") ) - gr.Markdown(value="1Aa-文本内容") + gr.Markdown(value=i18n("1Aa-文本内容")) with gr.Row(): gpu_numbers1a = gr.Textbox(label=i18n("GPU卡号以-分割,每个卡号一个进程"),value="%s-%s"%(gpus,gpus),interactive=True) bert_pretrained_dir = gr.Textbox(label=i18n("预训练的中文BERT模型路径"),value="GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large",interactive=False) @@ -697,7 +708,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app: with gr.Row(): batch_size = gr.Slider(minimum=1,maximum=40,step=1,label=i18n("每张显卡的batch_size"),value=default_batch_size,interactive=True) total_epoch = gr.Slider(minimum=1,maximum=20,step=1,label=i18n("总训练轮数total_epoch,不建议太高"),value=8,interactive=True) - text_low_lr_rate = gr.Slider(minimum=0.2,maximum=0.6,step=0.05,label="文本模块学习率权重",value=0.4,interactive=True) + text_low_lr_rate = gr.Slider(minimum=0.2,maximum=0.6,step=0.05,label=i18n("文本模块学习率权重"),value=0.4,interactive=True) save_every_epoch = gr.Slider(minimum=1,maximum=50,step=1,label=i18n("保存频率save_every_epoch"),value=4,interactive=True) if_save_latest = gr.Checkbox(label=i18n("是否仅保存最新的ckpt文件以节省硬盘空间"), value=True, interactive=True, show_label=True) if_save_every_weights = gr.Checkbox(label=i18n("是否在每次保存时间点将最终小模型保存至weights文件夹"), value=True, interactive=True, show_label=True) From 8deb526b5b5ff2e147fdfa4b546a46f63c42df2c Mon Sep 17 00:00:00 2001 From: Rice Cake Date: Mon, 22 Jan 2024 20:40:44 +0800 Subject: [PATCH 5/5] update i18n --- webui.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/webui.py b/webui.py index 4eaf901..ebd1dc7 100644 --- a/webui.py +++ b/webui.py @@ -4,13 +4,10 @@ sys.path.append(now_dir) import json,yaml,warnings,torch import platform import psutil -import os import signal warnings.filterwarnings("ignore") torch.manual_seed(233333) -import os,pdb,sys -now_dir = os.getcwd() tmp = os.path.join(now_dir, "TEMP") os.makedirs(tmp, exist_ok=True) os.environ["TEMP"] = tmp @@ -43,7 +40,7 @@ import gradio as gr from subprocess import Popen import signal from config import python_exec,infer_device,is_half,exp_root,webui_port_main,webui_port_infer_tts,webui_port_uvr5,webui_port_subfix,is_share -from i18n.i18n import I18nAuto +from tools.i18n.i18n import I18nAuto i18n = I18nAuto() from scipy.io import wavfile from tools.my_utils import load_audio @@ -653,7 +650,7 @@ with gr.Blocks(title=i18n("GPT-SoVITS WebUI")) as app: 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]) close_slicer_button.click(close_slice, [], [slicer_info,open_slicer_button,close_slicer_button]) - with gr.TabItem("1-GPT-SoVITS-TTS"): + with gr.TabItem(i18n("1-GPT-SoVITS-TTS")): with gr.Row(): exp_name = gr.Textbox(label=i18n("*实验/模型名"), value="xxx", interactive=True) gpu_info = gr.Textbox(label=i18n("显卡信息"), value=gpu_info, visible=True, interactive=False) @@ -749,7 +746,7 @@ with gr.Blocks(title=i18n("GPT-SoVITS WebUI")) as app: app.queue(concurrency_count=511, max_size=1022).launch( server_name="0.0.0.0", inbrowser=True, - share=True, + share=is_share, server_port=webui_port_main, quiet=True, )