Skip to content

Commit 6062b95

Browse files
committed
get_vc bug fix
1 parent 86f76f8 commit 6062b95

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

infer-web.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,20 @@ def get_vc(sid):
148148
global n_spk,tgt_sr,net_g,vc,cpt
149149
if(sid==[]):
150150
global hubert_model
151-
print("clean_empty_cache")
152-
del n_spk, vc, hubert_model,tgt_sr#,cpt
153-
hubert_model = net_g=n_spk=vc=hubert_model=tgt_sr=None
154-
torch.cuda.empty_cache()
155-
###楼下不这么折腾清理不干净
156-
if_f0 = cpt.get("f0", 1)
157-
if (if_f0 == 1):
158-
net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=is_half)
159-
else:
160-
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
161-
del net_g,cpt
162-
torch.cuda.empty_cache()
163-
cpt=None
151+
if (hubert_model != None): # 考虑到轮询,需要加个判断看是否 sid 是由有模型切换到无模型的
152+
print("clean_empty_cache")
153+
del net_g, n_spk, vc, hubert_model,tgt_sr#,cpt
154+
hubert_model = net_g=n_spk=vc=hubert_model=tgt_sr=None
155+
torch.cuda.empty_cache()
156+
###楼下不这么折腾清理不干净
157+
if_f0 = cpt.get("f0", 1)
158+
if (if_f0 == 1):
159+
net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=is_half)
160+
else:
161+
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
162+
del net_g,cpt
163+
torch.cuda.empty_cache()
164+
cpt=None
164165
return {"visible": False, "__type__": "update"}
165166
person = "%s/%s" % (weight_root, sid)
166167
print("loading %s"%person)

0 commit comments

Comments
 (0)