From 605b3801145bcac9abe568af54ee53e921367f39 Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:50:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=BC=82=E6=AD=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复模型加载异步逻辑 --- GPT_SoVITS/inference_webui.py | 5 ++--- GPT_SoVITS/inference_webui_fast.py | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/GPT_SoVITS/inference_webui.py b/GPT_SoVITS/inference_webui.py index e1afbd8..dd9086f 100644 --- a/GPT_SoVITS/inference_webui.py +++ b/GPT_SoVITS/inference_webui.py @@ -213,7 +213,6 @@ def resample(audio_tensor, sr0): #symbol_version-model_version-if_lora_v3 from process_ckpt import get_sovits_version_from_path_fast,load_sovits_new def change_sovits_weights(sovits_path,prompt_language=None,text_language=None): - yield [None]*10+[{"__type__": "update", "value":i18n("模型加载中,请等待"),"interactive":False}] global vq_model, hps, version, model_version, dict_language,if_lora_v3 version, model_version, if_lora_v3=get_sovits_version_from_path_fast(sovits_path) # print(sovits_path,version, model_version, if_lora_v3) @@ -239,7 +238,7 @@ def change_sovits_weights(sovits_path,prompt_language=None,text_language=None): else: visible_sample_steps=False visible_inp_refs=True - yield {'__type__':'update', 'choices':list(dict_language.keys())}, {'__type__':'update', 'choices':list(dict_language.keys())}, prompt_text_update, prompt_language_update, text_update, text_language_update,{"__type__": "update", "visible": visible_sample_steps},{"__type__": "update", "visible": visible_inp_refs},{"__type__": "update", "value": False,"interactive":True if model_version!="v3"else False},{"__type__": "update", "visible":True if model_version=="v3"else False},None + yield {'__type__':'update', 'choices':list(dict_language.keys())}, {'__type__':'update', 'choices':list(dict_language.keys())}, prompt_text_update, prompt_language_update, text_update, text_language_update,{"__type__": "update", "visible": visible_sample_steps,"value":32},{"__type__": "update", "visible": visible_inp_refs},{"__type__": "update", "value": False,"interactive":True if model_version!="v3"else False},{"__type__": "update", "visible":True if model_version=="v3"else False},{"__type__": "update", "value":i18n("模型加载中,请等待"),"interactive":False} dict_s2 = load_sovits_new(sovits_path) hps = dict_s2["config"] @@ -295,7 +294,7 @@ def change_sovits_weights(sovits_path,prompt_language=None,text_language=None): # torch.save(vq_model.state_dict(),"merge_win.pth") vq_model.eval() - yield [None]*10+[{"__type__": "update", "value":i18n("合成语音"),"interactive":True}] + yield {'__type__':'update', 'choices':list(dict_language.keys())}, {'__type__':'update', 'choices':list(dict_language.keys())}, prompt_text_update, prompt_language_update, text_update, text_language_update,{"__type__": "update", "visible": visible_sample_steps,"value":32},{"__type__": "update", "visible": visible_inp_refs},{"__type__": "update", "value": False,"interactive":True if model_version!="v3"else False},{"__type__": "update", "visible":True if model_version=="v3"else False},{"__type__": "update", "value":i18n("合成语音"),"interactive":True} with open("./weight.json")as f: data=f.read() data=json.loads(data) diff --git a/GPT_SoVITS/inference_webui_fast.py b/GPT_SoVITS/inference_webui_fast.py index 506f4e1..64b4e83 100644 --- a/GPT_SoVITS/inference_webui_fast.py +++ b/GPT_SoVITS/inference_webui_fast.py @@ -224,11 +224,10 @@ SoVITS_names, GPT_names = get_weights_names(GPT_weight_root, SoVITS_weight_root) from process_ckpt import get_sovits_version_from_path_fast,load_sovits_new def change_sovits_weights(sovits_path,prompt_language=None,text_language=None): - yield [None]*9+[{"__type__": "update", "value":i18n("模型加载中,请等待"),"interactive":False}] global version, model_version, dict_language,if_lora_v3 version, model_version, if_lora_v3=get_sovits_version_from_path_fast(sovits_path) # print(sovits_path,version, model_version, if_lora_v3) - if if_lora_v3==True and is_exist_s2gv3==False: + if if_lora_v3==True and is_exist_s2gv3==False:# info= "GPT_SoVITS/pretrained_models/s2Gv3.pth" + i18n("SoVITS V3 底模缺失,无法加载相应 LoRA 权重") gr.Warning(info) raise FileExistsError(info) @@ -251,10 +250,10 @@ def change_sovits_weights(sovits_path,prompt_language=None,text_language=None): visible_sample_steps=False visible_inp_refs=True #prompt_language,text_language,prompt_text,prompt_language,text,text_language,inp_refs,ref_text_free, - yield {'__type__':'update', 'choices':list(dict_language.keys())}, {'__type__':'update', 'choices':list(dict_language.keys())}, prompt_text_update, prompt_language_update, text_update, text_language_update,{"__type__": "update", "interactive": visible_sample_steps},{"__type__": "update", "visible": visible_inp_refs},{"__type__": "update", "interactive": True if model_version!="v3"else False},None + yield {'__type__':'update', 'choices':list(dict_language.keys())}, {'__type__':'update', 'choices':list(dict_language.keys())}, prompt_text_update, prompt_language_update, text_update, text_language_update,{"__type__": "update", "interactive": visible_sample_steps,"value":32},{"__type__": "update", "visible": visible_inp_refs},{"__type__": "update", "interactive": True if model_version!="v3"else False},{"__type__": "update", "value":i18n("模型加载中,请等待"),"interactive":False} tts_pipeline.init_vits_weights(sovits_path) - yield [None]*9+[{"__type__": "update", "value":i18n("合成语音"),"interactive":True}] + yield {'__type__':'update', 'choices':list(dict_language.keys())}, {'__type__':'update', 'choices':list(dict_language.keys())}, prompt_text_update, prompt_language_update, text_update, text_language_update,{"__type__": "update", "interactive": visible_sample_steps,"value":32},{"__type__": "update", "visible": visible_inp_refs},{"__type__": "update", "interactive": True if model_version!="v3"else False},{"__type__": "update", "value":i18n("合成语音"),"interactive":True} with open("./weight.json")as f: data=f.read() data=json.loads(data)