Skip to content

Commit

Permalink
Fix crash from inferring the dataset_id from a local dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaarsen committed May 10, 2024
1 parent 4443bf5 commit c8f8e30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sentence_transformers/model_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,13 @@ def subtuple_finder(tuple: Tuple[str], subtuple: Tuple[str]) -> int:
else:
author = None
dataset_name = cache_dataset_name
dataset_output["id"] = get_dataset_info(dataset_name).id
# We can still be dealing with a local dataset here, so we wrap this with try-except
try:
dataset_output["id"] = get_dataset_info(dataset_name).id
except Exception:
# We can have a wide range of errors here, such as the dataset not existing, no internet, etc.
# So we use the generic Exception
pass

# If the cache path ends with a 40 character hash, it is the current revision
if len(cache_path_parts[-2]) == 40:
Expand Down

0 comments on commit c8f8e30

Please sign in to comment.