Spaces:
Runtime error
Runtime error
Tristan Thrush
commited on
Commit
·
75fe862
1
Parent(s):
a288d91
changed to use metric name instead of metric type
Browse files
app.py
CHANGED
@@ -59,16 +59,16 @@ def parse_metrics_rows(meta, from_autoeval=False):
|
|
59 |
row["config"] = result["dataset"]["config"]
|
60 |
no_results = True
|
61 |
for metric in result["metrics"]:
|
62 |
-
|
63 |
-
if
|
64 |
# Metrics are not allowed to be named "dataset", "split", "config", or "verified".
|
65 |
continue
|
66 |
value = parse_metric_value(metric.get("value", None))
|
67 |
if value is None:
|
68 |
continue
|
69 |
-
if
|
70 |
-
new_metric_better = value < row[
|
71 |
-
if
|
72 |
# overwrite the metric if the new value is better.
|
73 |
|
74 |
if from_autoeval:
|
@@ -77,10 +77,10 @@ def parse_metrics_rows(meta, from_autoeval=False):
|
|
77 |
# in the leaderboard from the unverified model card.
|
78 |
if "verified" in metric and metric["verified"]:
|
79 |
no_results = False
|
80 |
-
row[
|
81 |
else:
|
82 |
no_results = False
|
83 |
-
row[
|
84 |
if no_results:
|
85 |
continue
|
86 |
yield row
|
|
|
59 |
row["config"] = result["dataset"]["config"]
|
60 |
no_results = True
|
61 |
for metric in result["metrics"]:
|
62 |
+
name = metric["name"].lower().strip()
|
63 |
+
if name in ("model_id", "dataset", "split", "config", "verified"):
|
64 |
# Metrics are not allowed to be named "dataset", "split", "config", or "verified".
|
65 |
continue
|
66 |
value = parse_metric_value(metric.get("value", None))
|
67 |
if value is None:
|
68 |
continue
|
69 |
+
if name in row:
|
70 |
+
new_metric_better = value < row[name] if name in ascending_metrics else value > row[name]
|
71 |
+
if name not in row or new_metric_better:
|
72 |
# overwrite the metric if the new value is better.
|
73 |
|
74 |
if from_autoeval:
|
|
|
77 |
# in the leaderboard from the unverified model card.
|
78 |
if "verified" in metric and metric["verified"]:
|
79 |
no_results = False
|
80 |
+
row[name] = value
|
81 |
else:
|
82 |
no_results = False
|
83 |
+
row[name] = value
|
84 |
if no_results:
|
85 |
continue
|
86 |
yield row
|