Spaces:
Running
Running
Fixing Some Bugs
Browse files- src/rvc.py +7 -3
src/rvc.py
CHANGED
@@ -2,6 +2,7 @@ from multiprocessing import cpu_count
|
|
2 |
from pathlib import Path
|
3 |
|
4 |
import torch
|
|
|
5 |
from fairseq import checkpoint_utils
|
6 |
from scipy.io import wavfile
|
7 |
|
@@ -109,11 +110,14 @@ class Config:
|
|
109 |
|
110 |
return x_pad, x_query, x_center, x_max
|
111 |
|
|
|
112 |
|
113 |
def load_hubert(device, is_half, model_path):
|
114 |
-
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
|
115 |
-
|
116 |
-
|
|
|
|
|
117 |
|
118 |
if is_half:
|
119 |
hubert = hubert.half()
|
|
|
2 |
from pathlib import Path
|
3 |
|
4 |
import torch
|
5 |
+
from fairseq.data.dictionary import Dictionary
|
6 |
from fairseq import checkpoint_utils
|
7 |
from scipy.io import wavfile
|
8 |
|
|
|
110 |
|
111 |
return x_pad, x_query, x_center, x_max
|
112 |
|
113 |
+
torch.serialization.add_safe_globals([Dictionary]) # Allowlist Fairseq's Dictionary class
|
114 |
|
115 |
def load_hubert(device, is_half, model_path):
|
116 |
+
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
|
117 |
+
[model_path], suffix='', arg_overrides={"weights_only": True} # Keep weights-only safe loading
|
118 |
+
)
|
119 |
+
|
120 |
+
hubert = models[0].to(device)
|
121 |
|
122 |
if is_half:
|
123 |
hubert = hubert.half()
|