fix: outside_index_root detection

This commit is contained in:
源文雨 2024-06-02 00:19:19 +09:00
parent dc09d0e13e
commit b0c33d1b75
2 changed files with 6 additions and 5 deletions

View File

@ -165,7 +165,7 @@ class VC:
times = [0, 0, 0] times = [0, 0, 0]
if self.hubert_model is None: 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: if file_index:
file_index = ( file_index = (

View File

@ -9,7 +9,8 @@ def get_index_path_from_model(sid):
f f
for f in [ for f in [
os.path.join(root, name) 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 for name in files
if name.endswith(".index") and "trained" not in name 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( models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
["assets/hubert/hubert_base.pt"], ["assets/hubert/hubert_base.pt"],
suffix="", suffix="",
) )
hubert_model = models[0] hubert_model = models[0]
hubert_model = hubert_model.to(config.device) hubert_model = hubert_model.to(device)
if config.is_half: if is_half:
hubert_model = hubert_model.half() hubert_model = hubert_model.half()
else: else:
hubert_model = hubert_model.float() hubert_model = hubert_model.float()