Skip to content

Commit

Permalink
Make model-index evaluation optional (#18)
Browse files Browse the repository at this point in the history
The model-index seems optional in HF Hub: https://github.com/huggingface/hub-docs/blame/main/modelcard.md
but it seems that it's required here. When a model is uploaded without
metrics, the push() command errors out.

This PR makes this metadata information optional
  • Loading branch information
ljvmiranda921 authored Jul 3, 2023
1 parent c76ac64 commit bc8f5cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spacy_huggingface_hub/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def _create_model_card(repo_name: str, repo_dir: Path) -> Dict[str, Any]:
metadata = _insert_values_as_list({}, "tags", tags)
metadata = _insert_values_as_list(metadata, "language", lang)
metadata = _insert_value(metadata, "license", lic)
metadata["model-index"] = _create_model_index(repo_name, data["performance"])
if "performance" in data:
metadata["model-index"] = _create_model_index(repo_name, data["performance"])
metadata = yaml.dump(metadata, sort_keys=False)
metadata_section = f"---\n{metadata}---\n"

Expand Down

0 comments on commit bc8f5cf

Please sign in to comment.