Spaces:
Runtime error
Runtime error
Tristan Thrush
commited on
Commit
·
aa1e2a0
1
Parent(s):
bb28608
fixed bugs in selection of verified results
Browse files
app.py
CHANGED
@@ -57,9 +57,10 @@ def parse_metrics_rows(meta, from_autoeval=False):
|
|
57 |
row["split"] = result["dataset"]["split"]
|
58 |
if "config" in result["dataset"]:
|
59 |
row["config"] = result["dataset"]["config"]
|
|
|
60 |
for metric in result["metrics"]:
|
61 |
type = metric["type"].lower().strip()
|
62 |
-
if type
|
63 |
# Metrics are not allowed to be named "dataset", "split", "config", or "verified".
|
64 |
continue
|
65 |
value = parse_metric_value(metric.get("value", None))
|
@@ -75,9 +76,13 @@ def parse_metrics_rows(meta, from_autoeval=False):
|
|
75 |
# it is a verified metric. Unverified metrics are already included
|
76 |
# in the leaderboard from the unverified model card.
|
77 |
if "verified" in metric and metric["verified"]:
|
|
|
78 |
row[type] = value
|
79 |
else:
|
|
|
80 |
row[type] = value
|
|
|
|
|
81 |
yield row
|
82 |
|
83 |
@st.cache(ttl=3600)
|
@@ -144,7 +149,7 @@ dataset_df = dataset_df.dropna(axis="columns", how="all")
|
|
144 |
if only_verified_results:
|
145 |
dataset_df = dataset_df[dataset_df["verified"]]
|
146 |
|
147 |
-
selectable_metrics = list(filter(lambda column: column not in ("model_id", "dataset"), dataset_df.columns))
|
148 |
|
149 |
dataset_df = dataset_df.filter(["model_id"] + selectable_metrics)
|
150 |
dataset_df = dataset_df.dropna(thresh=2) # Want at least two non-na values (one for model_id and one for a metric).
|
|
|
57 |
row["split"] = result["dataset"]["split"]
|
58 |
if "config" in result["dataset"]:
|
59 |
row["config"] = result["dataset"]["config"]
|
60 |
+
no_results = True
|
61 |
for metric in result["metrics"]:
|
62 |
type = metric["type"].lower().strip()
|
63 |
+
if type 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))
|
|
|
76 |
# it is a verified metric. Unverified metrics are already included
|
77 |
# in the leaderboard from the unverified model card.
|
78 |
if "verified" in metric and metric["verified"]:
|
79 |
+
no_results = False
|
80 |
row[type] = value
|
81 |
else:
|
82 |
+
no_results = False
|
83 |
row[type] = value
|
84 |
+
if no_results:
|
85 |
+
continue
|
86 |
yield row
|
87 |
|
88 |
@st.cache(ttl=3600)
|
|
|
149 |
if only_verified_results:
|
150 |
dataset_df = dataset_df[dataset_df["verified"]]
|
151 |
|
152 |
+
selectable_metrics = list(filter(lambda column: column not in ("model_id", "dataset", "split", "config", "verified"), dataset_df.columns))
|
153 |
|
154 |
dataset_df = dataset_df.filter(["model_id"] + selectable_metrics)
|
155 |
dataset_df = dataset_df.dropna(thresh=2) # Want at least two non-na values (one for model_id and one for a metric).
|