Skip to content

Commit 5347c17

Browse files
avfedirz
authored andcommitted
fix: do not fail when hf cache location contains unparseable paths
1 parent e712d14 commit 5347c17

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/speaches/hf_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def get_model_path(model_id: str, *, cache_dir: str | Path | None = None) -> Pat
139139
continue
140140
if repo_path.name == ".locks": # skip './.locks/' folder
141141
continue
142+
if "--" not in repo_path.name: # cache might contain unrelated custom files
143+
continue
142144
repo_type, repo_id = repo_path.name.split("--", maxsplit=1)
143145
repo_type = repo_type[:-1] # "models" -> "model"
144146
repo_id = repo_id.replace("--", "/") # google--fleurs -> "google/fleurs"

0 commit comments

Comments
 (0)