Unverified Commit 801ec115 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Add checks to build cleaner model cards (#13542)

* Add checks to build cleaner model cards

* Address review comments
parent c1e47bf4
......@@ -315,6 +315,7 @@ def _insert_values_as_list(metadata, name, values):
return metadata
if isinstance(values, str):
values = [values]
values = [v for v in values if v is not None]
if len(values) == 0:
return metadata
metadata[name] = values
......@@ -438,7 +439,11 @@ class TrainingSummary:
}
)
model_index["results"].append(result)
# Remove partial results to avoid the model card being rejected.
if "task" in result and "dataset" in result and "metrics" in result:
model_index["results"].append(result)
else:
logger.info(f"Dropping the following result as it does not have all the necessary field:\n{result}")
return [model_index]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment