update populate
Browse files- src/populate.py +6 -5
src/populate.py
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
-
# src/populate.py
|
2 |
-
|
3 |
import os
|
4 |
import pandas as pd
|
5 |
import json
|
6 |
|
7 |
from src.display.utils import COLUMNS, EVAL_COLS, Tasks
|
8 |
-
from src.envs import EVAL_RESULTS_PATH
|
9 |
|
10 |
def get_leaderboard_df(eval_results_path, eval_requests_path, cols, benchmark_cols):
|
11 |
# Initialize an empty DataFrame
|
@@ -22,7 +20,6 @@ def get_leaderboard_df(eval_results_path, eval_requests_path, cols, benchmark_co
|
|
22 |
for file in result_files:
|
23 |
with open(file, 'r') as f:
|
24 |
data = json.load(f)
|
25 |
-
# Flatten the JSON structure if needed
|
26 |
flattened_data = {}
|
27 |
flattened_data.update(data.get('config', {}))
|
28 |
flattened_data.update(data.get('results', {}))
|
@@ -35,6 +32,10 @@ def get_leaderboard_df(eval_results_path, eval_requests_path, cols, benchmark_co
|
|
35 |
if col not in df.columns:
|
36 |
df[col] = None
|
37 |
|
|
|
|
|
|
|
|
|
38 |
# Sort by 'average' column if it exists
|
39 |
if 'average' in df.columns:
|
40 |
df = df.sort_values(by=['average'], ascending=False)
|
@@ -66,4 +67,4 @@ def get_evaluation_queue_df(eval_requests_path, eval_cols):
|
|
66 |
running_df = df[df['status'] == 'running']
|
67 |
pending_df = df[df['status'] == 'pending']
|
68 |
|
69 |
-
return finished_df, running_df, pending_df
|
|
|
|
|
|
|
1 |
import os
|
2 |
import pandas as pd
|
3 |
import json
|
4 |
|
5 |
from src.display.utils import COLUMNS, EVAL_COLS, Tasks
|
6 |
+
from src.envs import EVAL_RESULTS_PATH
|
7 |
|
8 |
def get_leaderboard_df(eval_results_path, eval_requests_path, cols, benchmark_cols):
|
9 |
# Initialize an empty DataFrame
|
|
|
20 |
for file in result_files:
|
21 |
with open(file, 'r') as f:
|
22 |
data = json.load(f)
|
|
|
23 |
flattened_data = {}
|
24 |
flattened_data.update(data.get('config', {}))
|
25 |
flattened_data.update(data.get('results', {}))
|
|
|
32 |
if col not in df.columns:
|
33 |
df[col] = None
|
34 |
|
35 |
+
# Convert 'average' column to float and handle errors
|
36 |
+
if 'average' in df.columns:
|
37 |
+
df['average'] = pd.to_numeric(df['average'], errors='coerce')
|
38 |
+
|
39 |
# Sort by 'average' column if it exists
|
40 |
if 'average' in df.columns:
|
41 |
df = df.sort_values(by=['average'], ascending=False)
|
|
|
67 |
running_df = df[df['status'] == 'running']
|
68 |
pending_df = df[df['status'] == 'pending']
|
69 |
|
70 |
+
return finished_df, running_df, pending_df
|