Commit
233c78c
1 Parent(s): f84a30a

update populate

Browse files
Files changed (1) hide show
  1. src/populate.py +12 -9
src/populate.py CHANGED
@@ -8,17 +8,20 @@ from src.display.utils import AutoEvalColumn, EvalQueueColumn
8
  from src.leaderboard.read_evals import get_raw_eval_results
9
 
10
 
11
- def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
12
- """Creates a dataframe from all the individual experiment results"""
13
- raw_data = get_raw_eval_results(results_path, requests_path)
14
- all_data_json = [v.to_dict() for v in raw_data]
15
-
16
- df = pd.DataFrame.from_records(all_data_json)
 
 
 
 
 
 
17
  df = df.sort_values(by=['average'], ascending=False)
18
- df = df[cols].round(decimals=2)
19
 
20
- # Filter out if any of the benchmarks have not been produced
21
- df = df[has_no_nan_values(df, benchmark_cols)]
22
  return df
23
 
24
 
 
8
  from src.leaderboard.read_evals import get_raw_eval_results
9
 
10
 
11
+ def get_leaderboard_df(eval_results_path, eval_requests_path, cols, benchmark_cols):
12
+ # Load evaluation results into a DataFrame
13
+ df = load_evaluation_results(eval_results_path)
14
+
15
+ # Check if the DataFrame is empty
16
+ if df.empty:
17
+ print("No evaluation results found. The leaderboard is currently empty.")
18
+ # Create an empty DataFrame with the required columns
19
+ df = pd.DataFrame(columns=cols)
20
+ return df
21
+
22
+ # Proceed to sort the DataFrame by 'average' if it's not empty
23
  df = df.sort_values(by=['average'], ascending=False)
 
24
 
 
 
25
  return df
26
 
27