diff --git a/rvc/modules/vc/modules.py b/rvc/modules/vc/modules.py index f5778c3..2c08974 100644 --- a/rvc/modules/vc/modules.py +++ b/rvc/modules/vc/modules.py @@ -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 diff --git a/rvc/modules/vc/utils.py b/rvc/modules/vc/utils.py index c128707..94f6f53 100644 --- a/rvc/modules/vc/utils.py +++ b/rvc/modules/vc/utils.py @@ -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()