Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
6fb03e0
1 Parent(s): f3b296a

fix: fix the rank issue

Browse files
Files changed (2) hide show
  1. src/leaderboard/read_evals.py +4 -4
  2. utils.py +3 -1
src/leaderboard/read_evals.py CHANGED
@@ -68,7 +68,7 @@ class FullEvalResult:
68
  config = item.get("config", {})
69
  # eval results for different metrics
70
  results = item.get("results", [])
71
- retrieval_model_link=config["retreival_model_link"]
72
  if config["reranking_model_link"] is not None:
73
  reranking_model_link=""
74
  eval_result = EvalResult(
@@ -180,9 +180,9 @@ def get_leaderboard_df(raw_data: List[FullEvalResult], task: str, metric: str) -
180
  # calculate the average score for selected benchmarks
181
  _benchmark_cols = frozenset(benchmark_cols).intersection(frozenset(df.columns.to_list()))
182
  df[COL_NAME_AVG] = df[list(_benchmark_cols)].mean(axis=1).round(decimals=2)
183
- df = df.sort_values(by=[COL_NAME_AVG], ascending=False)
184
- df.reset_index(inplace=True)
185
- df[COL_NAME_RANK] = df[COL_NAME_AVG].rank(ascending=False, method="dense")
186
 
187
  _cols = frozenset(cols).intersection(frozenset(df.columns.to_list()))
188
  df = df[_cols].round(decimals=2)
 
68
  config = item.get("config", {})
69
  # eval results for different metrics
70
  results = item.get("results", [])
71
+ retrieval_model_link=config["retrieval_model_link"]
72
  if config["reranking_model_link"] is not None:
73
  reranking_model_link=""
74
  eval_result = EvalResult(
 
180
  # calculate the average score for selected benchmarks
181
  _benchmark_cols = frozenset(benchmark_cols).intersection(frozenset(df.columns.to_list()))
182
  df[COL_NAME_AVG] = df[list(_benchmark_cols)].mean(axis=1).round(decimals=2)
183
+ df.sort_values(by=[COL_NAME_AVG], ascending=False, inplace=True)
184
+ df.reset_index(inplace=True, drop=True)
185
+ df[COL_NAME_RANK] = df[COL_NAME_AVG].rank(ascending=False, method="min")
186
 
187
  _cols = frozenset(cols).intersection(frozenset(df.columns.to_list()))
188
  df = df[_cols].round(decimals=2)
utils.py CHANGED
@@ -78,7 +78,9 @@ def select_columns(df: pd.DataFrame, domain_query: list, language_query: list, t
78
  # We use COLS to maintain sorting
79
  filtered_df = df[FIXED_COLS + selected_cols]
80
  filtered_df[COL_NAME_AVG] = filtered_df[selected_cols].mean(axis=1).round(decimals=2)
81
- filtered_df[COL_NAME_RANK] = filtered_df[COL_NAME_AVG].rank(ascending=False, method="dense")
 
 
82
 
83
  return filtered_df
84
 
 
78
  # We use COLS to maintain sorting
79
  filtered_df = df[FIXED_COLS + selected_cols]
80
  filtered_df[COL_NAME_AVG] = filtered_df[selected_cols].mean(axis=1).round(decimals=2)
81
+ filtered_df.sort_values(by=[COL_NAME_AVG], ascending=False, inplace=True)
82
+ filtered_df.reset_index(inplace=True, drop=True)
83
+ filtered_df[COL_NAME_RANK] = filtered_df[COL_NAME_AVG].rank(ascending=False, method="min")
84
 
85
  return filtered_df
86