1
0
mirror of synced 2024-11-27 17:00:54 +01:00

Update utils.py

This commit is contained in:
RVC-Boss 2023-08-31 17:51:55 +08:00 committed by GitHub
parent ca2308fd2f
commit 259ea663d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(