Spaces:
Sleeping
Sleeping
Add fallback sorting when no task results exist
Browse files- src/populate.py +9 -2
src/populate.py
CHANGED
|
@@ -16,8 +16,15 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 16 |
|
| 17 |
df = pd.DataFrame.from_records(all_data_json)
|
| 18 |
# Sort by the first task (EMEA NER) since we don't have an average for NER tasks
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
df = df[cols].round(decimals=2)
|
| 22 |
|
| 23 |
# filter out if any of the benchmarks have not been produced
|
|
|
|
| 16 |
|
| 17 |
df = pd.DataFrame.from_records(all_data_json)
|
| 18 |
# Sort by the first task (EMEA NER) since we don't have an average for NER tasks
|
| 19 |
+
# If no results exist yet, just sort by model name
|
| 20 |
+
if not df.empty:
|
| 21 |
+
first_task = list(Tasks)[0] # emea_ner
|
| 22 |
+
task_col_name = getattr(AutoEvalColumn, first_task.name).name
|
| 23 |
+
if task_col_name in df.columns:
|
| 24 |
+
df = df.sort_values(by=[task_col_name], ascending=False)
|
| 25 |
+
else:
|
| 26 |
+
# Fallback to sorting by model name if no task results yet
|
| 27 |
+
df = df.sort_values(by=[AutoEvalColumn.model.name], ascending=True)
|
| 28 |
df = df[cols].round(decimals=2)
|
| 29 |
|
| 30 |
# filter out if any of the benchmarks have not been produced
|