Update utils.py
This commit is contained in:
parent
ca2308fd2f
commit
259ea663d4
@ -2,22 +2,32 @@ import os
|
|||||||
|
|
||||||
from fairseq import checkpoint_utils
|
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):
|
def get_index_path_from_model(sid):
|
||||||
return next(
|
sel_index_path = ""
|
||||||
(
|
name = os.path.join("logs", sid.split(".")[0], "")
|
||||||
f
|
# print(name)
|
||||||
for f in [
|
for f in index_paths:
|
||||||
os.path.join(root, name)
|
if name in f:
|
||||||
for root, dirs, files in os.walk(os.getenv("index_root"), topdown=False)
|
# print("selected index path:", f)
|
||||||
for name in files
|
sel_index_path = f
|
||||||
if name.endswith(".index") and "trained" not in name
|
break
|
||||||
]
|
return sel_index_path
|
||||||
if sid.split(".")[0] in f
|
|
||||||
),
|
|
||||||
"",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def load_hubert(config):
|
def load_hubert(config):
|
||||||
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
|
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
|
||||||
|
Loading…
Reference in New Issue
Block a user