File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 21
21
import glob
22
22
from shutil import move
23
23
24
-
25
24
sup_audioext = {
26
25
"wav" ,
27
26
"mp3" ,
@@ -49,21 +48,23 @@ def note_to_hz(note_name):
49
48
except :
50
49
return None
51
50
52
- def load_hubert ():
51
+ def load_hubert (hubert_model_path , config ):
53
52
from fairseq import checkpoint_utils
54
53
55
- hubert_path = "assets/hubert/hubert_base.pt"
56
-
57
54
models , _ , _ = checkpoint_utils .load_model_ensemble_and_task (
58
- [hubert_path ],
55
+ [hubert_model_path ],
59
56
suffix = "" ,
60
57
)
61
58
hubert_model = models [0 ]
62
- hubert_model = hubert_model .float ()
63
- hubert_model .eval ()
59
+ hubert_model = hubert_model .to (config .device )
60
+ if config .is_half :
61
+ hubert_model = hubert_model .half ()
62
+ else :
63
+ hubert_model = hubert_model .float ()
64
+
65
+ hubert_models = hubert_model .eval ()
66
+ return hubert_models
64
67
65
- return hubert_model
66
-
67
68
class VC :
68
69
def __init__ (self , config ):
69
70
self .n_spk = None
@@ -459,10 +460,10 @@ def vc_single(
459
460
times = [0 , 0 , 0 ]
460
461
461
462
if self .hubert_model is None :
462
- self .hubert_model = load_hubert ()
463
+ self .hubert_model = load_hubert (hubert_model_path , self . config )
463
464
464
- # try:
465
- # self.if_f0 = self.cpt.get("f0", 1)
465
+ try :
466
+ self .if_f0 = self .cpt .get ("f0" , 1 )
466
467
except NameError :
467
468
message = "Model was not properly selected"
468
469
print (message )
You can’t perform that action at this time.
0 commit comments