Skip to content

Commit

Permalink
Catch HFValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
cg123 committed Jan 9, 2024
1 parent 190cf2f commit aba81d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mergekit/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import huggingface_hub
import yaml
from huggingface_hub.utils import HFValidationError
from yaml.nodes import SequenceNode as SequenceNode

from mergekit.config import MergeConfiguration, ModelReference
Expand Down Expand Up @@ -60,7 +61,10 @@ def is_hf(path: str) -> bool:
return False # definitely a local path
if not os.path.exists(path):
return True # If path doesn't exist locally, it must be a HF repo
return huggingface_hub.repo_exists(path, repo_type="model", token=False)
try:
return huggingface_hub.repo_exists(path, repo_type="model", token=False)
except HFValidationError:
return False


def extract_hf_paths(models: List[ModelReference]) -> Sequence[str]:
Expand Down

0 comments on commit aba81d9

Please sign in to comment.