Skip to content

Commit 043e2e9

Browse files
authored
Update modules.py
1 parent 4f3adb4 commit 043e2e9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/modules.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import time
2121
import glob
2222
from shutil import move
23-
from fairseq import checkpoint_utils
23+
2424

2525
sup_audioext = {
2626
"wav",
@@ -49,9 +49,13 @@ def note_to_hz(note_name):
4949
except:
5050
return None
5151

52-
def load_hubert(hubert_model_path, config):
52+
def load_hubert(config, hubert_path=None):
53+
from fairseq import checkpoint_utils
54+
55+
hubert_path = "hubert_base.pt"
56+
5357
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
54-
[hubert_model_path],
58+
[hubert_path],
5559
suffix="",
5660
)
5761
hubert_model = models[0]
@@ -60,8 +64,10 @@ def load_hubert(hubert_model_path, config):
6064
hubert_model = hubert_model.half()
6165
else:
6266
hubert_model = hubert_model.float()
63-
return hubert_model.eval()
67+
hubert_model.eval()
6468

69+
return hubert_model
70+
6571
class VC:
6672
def __init__(self, config):
6773
self.n_spk = None
@@ -556,4 +562,4 @@ def vc_single(
556562
(info, None, [None, None, None, None]),
557563
(None, None),
558564
None
559-
)
565+
)

0 commit comments

Comments
 (0)