Apply Code Formatter Change

This commit is contained in:
Tps-F
2023-08-19 10:57:09 +00:00
committed by github-actions[bot]
parent 2e56c5c600
commit c14721d9c3
3 changed files with 137 additions and 107 deletions

View File

@@ -6,7 +6,19 @@ from fairseq import checkpoint_utils
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), "")
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 load_hubert(config):
@@ -21,8 +33,8 @@ def load_hubert(config):
else:
hubert_model = hubert_model.float()
return hubert_model.eval()
def load_audio(file, sr):
try:
# https://github.com/openai/whisper/blob/main/whisper/audio.py#L26
@@ -39,4 +51,4 @@ def load_audio(file, sr):
except Exception as e:
raise RuntimeError(f"Failed to load audio: {e}")
return np.frombuffer(out, np.float32).flatten()
return np.frombuffer(out, np.float32).flatten()