Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
eduagarcia
commited on
Commit
•
e21873c
1
Parent(s):
43c2b1a
Unselect task datasets will update average and npm
Browse files
app.py
CHANGED
@@ -28,7 +28,8 @@ from src.display.utils import (
|
|
28 |
ModelType,
|
29 |
fields,
|
30 |
WeightType,
|
31 |
-
Precision
|
|
|
32 |
)
|
33 |
from src.envs import (
|
34 |
API,
|
@@ -126,6 +127,7 @@ def update_table(
|
|
126 |
):
|
127 |
filtered_df = filter_models(df=hidden_df, type_query=type_query, size_query=size_query, precision_query=precision_query, hide_models=hide_models)
|
128 |
filtered_df = filter_queries(query, filtered_df)
|
|
|
129 |
df = select_columns(filtered_df, columns)
|
130 |
return df
|
131 |
|
@@ -200,6 +202,21 @@ def filter_models(
|
|
200 |
|
201 |
return filtered_df
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
leaderboard_df = filter_models(
|
204 |
df=leaderboard_df,
|
205 |
type_query=[t.to_str(" : ") for t in ModelType],
|
|
|
28 |
ModelType,
|
29 |
fields,
|
30 |
WeightType,
|
31 |
+
Precision,
|
32 |
+
Tasks
|
33 |
)
|
34 |
from src.envs import (
|
35 |
API,
|
|
|
127 |
):
|
128 |
filtered_df = filter_models(df=hidden_df, type_query=type_query, size_query=size_query, precision_query=precision_query, hide_models=hide_models)
|
129 |
filtered_df = filter_queries(query, filtered_df)
|
130 |
+
filtered_df = update_leaderboard_avg_scores(filtered_df, columns)
|
131 |
df = select_columns(filtered_df, columns)
|
132 |
return df
|
133 |
|
|
|
202 |
|
203 |
return filtered_df
|
204 |
|
205 |
+
def update_leaderboard_avg_scores(df, columns):
|
206 |
+
new_df = df.copy()
|
207 |
+
|
208 |
+
#update average with tasks in shown columns
|
209 |
+
task_columns = []
|
210 |
+
task_baseline = []
|
211 |
+
for task in Tasks:
|
212 |
+
column_name = getattr(AutoEvalColumn, task.name).name
|
213 |
+
if column_name in columns:
|
214 |
+
task_columns.append(column_name)
|
215 |
+
task_baseline.append(task.value.baseline)
|
216 |
+
new_df[AutoEvalColumn.average.name] = new_df[task_columns].mean(axis=1).apply(lambda x: round(x, 2))
|
217 |
+
new_df[AutoEvalColumn.npm.name] = (((new_df[task_columns] - task_baseline) / [100.0 - t for t in task_baseline]).mean(axis=1) * 100).apply(lambda x: round(x, 2))
|
218 |
+
return new_df
|
219 |
+
|
220 |
leaderboard_df = filter_models(
|
221 |
df=leaderboard_df,
|
222 |
type_query=[t.to_str(" : ") for t in ModelType],
|