File size: 661 Bytes
8c49cb6 117d89c 7fdb5f5 8c49cb6 7fdb5f5 c1b8a96 3dfaf22 b1a1395 8c49cb6 b1a1395 8c49cb6 b1a1395 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import pandas as pd
from src.display.utils import AutoEvalColumn
from src.leaderboard.read_evals import get_raw_eval_results, EvalResult
def get_leaderboard_df(
results_path: str, requests_path: str, cols: list, benchmark_cols: list
) -> tuple[list[EvalResult], pd.DataFrame]:
"""Creates a dataframe from all the individual experiment results"""
raw_data = get_raw_eval_results(results_path, requests_path)
all_data_json = [v.to_dict() for v in raw_data]
df = pd.DataFrame.from_records(all_data_json)
df = df.sort_values(by=[AutoEvalColumn.average.name], ascending=False)
df = df[cols].round(decimals=2)
return raw_data, df
|