pufanyi commited on
Commit
88477a4
·
1 Parent(s): 56f8949

chore: Refactor get_leaderboard_df to handle multiple subsets in populate.py

Browse files
Files changed (1) hide show
  1. src/populate.py +11 -7
src/populate.py CHANGED
@@ -9,10 +9,14 @@ from src.display.utils import AutoEvalColumn, EvalQueueColumn
9
  from datasets import load_dataset
10
 
11
 
12
- def get_leaderboard_df(results_repo, results_path, dataset_version):
13
- hf_leaderboard = load_dataset(results_repo, dataset_version, split="test", cache_dir=results_path)
14
- df = hf_leaderboard.to_pandas()
15
- df = df.sort_values(by="Total", ascending=False)
16
- df = df.round(2) # Round all numeric columns to two decimal places
17
- print(df)
18
- return df
 
 
 
 
 
9
  from datasets import load_dataset
10
 
11
 
12
+ def get_leaderboard_df(results_repo, results_path):
13
+ subsets = load_dataset(results_repo, split='all', cache_dir=results_path)
14
+ subset_dfs = {}
15
+ print("Subsets:", subsets.keys())
16
+ for subset_name in subsets.keys():
17
+ subset_df = subsets[subset_name].to_pandas()
18
+ subset_df = subset_df.sort_values(by="Total", ascending=False)
19
+ subset_df = subset_df.round(2) # Round all numeric columns to two decimal places
20
+ print(subset_df)
21
+ subset_dfs[subset_name] = subset_df
22
+ return subset_dfs