Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use default model_name in metadata_update #1157

Merged
merged 5 commits into from
Nov 8, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/huggingface_hub/repocard.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,9 @@ def metadata_update(

for key, value in metadata.items():
if key == "model-index":
# if the new metadata doesn't include a name, either use existing one or repo name
if "name" not in value[0]:
value[0]["name"] = getattr(card, "model_name", repo_id.split("/")[-1])
model_name, new_results = model_index_to_eval_results(value)
if card.data.eval_results is None:
card.data.eval_results = new_results
Expand Down