From 259ea663d4c2019a474e5e65ed42d3502d0d3a49 Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:51:55 +0800 Subject: [PATCH] Update utils.py --- infer/modules/vc/utils.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/infer/modules/vc/utils.py b/infer/modules/vc/utils.py index 98497e2..9cc4830 100644 --- a/infer/modules/vc/utils.py +++ b/infer/modules/vc/utils.py @@ -2,22 +2,32 @@ import os from fairseq import checkpoint_utils +### don't modify the code before you test it +# def get_index_path_from_model(sid): +# return next( +# ( +# f +# for f in [ +# os.path.join(root, name) +# for root, dirs, files in os.walk(os.getenv("index_root"), topdown=False) +# for name in files +# if name.endswith(".index") and "trained" not in name +# ] +# if sid.split(".")[0] in f +# ), +# "", +# ) def get_index_path_from_model(sid): - return next( - ( - f - for f in [ - os.path.join(root, name) - for root, dirs, files in os.walk(os.getenv("index_root"), topdown=False) - for name in files - if name.endswith(".index") and "trained" not in name - ] - if sid.split(".")[0] in f - ), - "", - ) - + sel_index_path = "" + name = os.path.join("logs", sid.split(".")[0], "") + # print(name) + for f in index_paths: + if name in f: + # print("selected index path:", f) + sel_index_path = f + break + return sel_index_path def load_hubert(config): models, _, _ = checkpoint_utils.load_model_ensemble_and_task(