From b0c33d1b75b220ea5efbc4de40651136b7cf9736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 2 Jun 2024 00:19:19 +0900 Subject: [PATCH] fix: outside_index_root detection --- infer/modules/vc/modules.py | 2 +- infer/modules/vc/utils.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/infer/modules/vc/modules.py b/infer/modules/vc/modules.py index 9069072..a459784 100644 --- a/infer/modules/vc/modules.py +++ b/infer/modules/vc/modules.py @@ -165,7 +165,7 @@ class VC: times = [0, 0, 0] if self.hubert_model is None: - self.hubert_model = load_hubert(self.config) + self.hubert_model = load_hubert(self.config.device, self.config.is_half) if file_index: file_index = ( diff --git a/infer/modules/vc/utils.py b/infer/modules/vc/utils.py index c128707..0df05f6 100644 --- a/infer/modules/vc/utils.py +++ b/infer/modules/vc/utils.py @@ -9,7 +9,8 @@ def get_index_path_from_model(sid): f for f in [ os.path.join(root, name) - for root, _, files in os.walk(os.getenv("index_root"), topdown=False) + for path in [os.getenv("outside_index_root"), os.getenv("index_root")] + for root, _, files in os.walk(path, topdown=False) for name in files if name.endswith(".index") and "trained" not in name ] @@ -19,14 +20,14 @@ def get_index_path_from_model(sid): ) -def load_hubert(config): +def load_hubert(device, is_half): models, _, _ = checkpoint_utils.load_model_ensemble_and_task( ["assets/hubert/hubert_base.pt"], suffix="", ) hubert_model = models[0] - hubert_model = hubert_model.to(config.device) - if config.is_half: + hubert_model = hubert_model.to(device) + if is_half: hubert_model = hubert_model.half() else: hubert_model = hubert_model.float()