Support other hubert

This commit is contained in:
Ftps
2023-11-19 04:14:30 +09:00
parent 902654a1eb
commit 90d0b639c4
2 changed files with 5 additions and 9 deletions

View File

@@ -99,9 +99,8 @@ class VC:
protect: float = 0.33,
hubert_path: str | None = None,
):
if input_audio_path is None:
return "You need to upload an audio", None
f0_up_key = int(f0_up_key)
hubert_path = os.getenv("hubert_path") if not hubert_path else hubert_path
try:
audio = load_audio(input_audio_path, 16000)
audio_max = np.abs(audio).max() / 0.95

View File

@@ -19,15 +19,12 @@ def get_index_path_from_model(sid):
)
def load_hubert(config):
def load_hubert(config, hubert_path: str):
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
["assets/hubert/hubert_base.pt"],
[hubert_path],
suffix="",
)
hubert_model = models[0]
hubert_model = hubert_model.to(config.device)
if config.is_half:
hubert_model = hubert_model.half()
else:
hubert_model = hubert_model.float()
hubert_model = hubert_model.half() if config.is_half else hubert_model.float()
return hubert_model.eval()