Skip to content

Commit ce6add8

Browse files
authored
🐛 fix small model card bugs (huggingface#13310)
* 🐛 fix small model card bugs * 💄 style
1 parent 139e830 commit ce6add8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/transformers/modelcard.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,15 @@ def create_model_index(self, metric_mapping):
426426
result["dataset"]["args"] = dataset_arg_mapping[ds_tag]
427427

428428
if len(metric_mapping) > 0:
429+
result["metrics"] = []
429430
for metric_tag, metric_name in metric_mapping.items():
430-
result["metric"] = {
431-
"name": metric_name,
432-
"type": metric_tag,
433-
"value": self.eval_results[metric_name],
434-
}
431+
result["metrics"].append(
432+
{
433+
"name": metric_name,
434+
"type": metric_tag,
435+
"value": self.eval_results[metric_name],
436+
}
437+
)
435438

436439
model_index["results"].append(result)
437440

@@ -446,7 +449,7 @@ def create_metadata(self):
446449
metadata = _insert_values_as_list(metadata, "tags", self.tags)
447450
metadata = _insert_values_as_list(metadata, "datasets", self.dataset_tags)
448451
metadata = _insert_values_as_list(metadata, "metrics", list(metric_mapping.keys()))
449-
metadata["model_index"] = self.create_model_index(metric_mapping)
452+
metadata["model-index"] = self.create_model_index(metric_mapping)
450453

451454
return metadata
452455

0 commit comments

Comments
 (0)