Alina Lozovskaia commited on
Commit
ecacc0f
1 Parent(s): d131b6c

removed dummy column

Browse files
app.py CHANGED
@@ -154,7 +154,7 @@ def load_query(request: gr.Request): # triggered only once at startup => read q
154
 
155
 
156
  def search_model(df: pd.DataFrame, query: str) -> pd.DataFrame:
157
- return df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False, na=False))]
158
 
159
 
160
  def search_license(df: pd.DataFrame, query: str) -> pd.DataFrame:
@@ -163,14 +163,10 @@ def search_license(df: pd.DataFrame, query: str) -> pd.DataFrame:
163
 
164
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
165
  always_here_cols = [c.name for c in fields(AutoEvalColumn) if c.never_hidden]
166
- dummy_col = [AutoEvalColumn.dummy.name]
167
- # AutoEvalColumn.model_type_symbol.name,
168
- # AutoEvalColumn.model.name,
169
- # We use COLS to maintain sorting
170
- filtered_df = df[always_here_cols + [c for c in COLS if c in df.columns and c in columns] + dummy_col]
171
  return filtered_df
172
 
173
-
174
  def filter_queries(query: str, df: pd.DataFrame):
175
  tmp_result_df = []
176
 
@@ -327,16 +323,13 @@ with demo:
327
 
328
  leaderboard_table = gr.components.Dataframe(
329
  value=leaderboard_df[
330
- [c.name for c in fields(AutoEvalColumn) if c.never_hidden]
331
- + shown_columns.value
332
- + [AutoEvalColumn.dummy.name]
333
  ],
334
  headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
335
  datatype=TYPES,
336
  elem_id="leaderboard-table",
337
  interactive=False,
338
  visible=True,
339
- # column_widths=["2%", "33%"]
340
  )
341
 
342
  # Dummy leaderboard for handling the case when the user uses backspace key
 
154
 
155
 
156
  def search_model(df: pd.DataFrame, query: str) -> pd.DataFrame:
157
+ return df[(df[AutoEvalColumn.model.name].str.contains(query, case=False, na=False))]
158
 
159
 
160
  def search_license(df: pd.DataFrame, query: str) -> pd.DataFrame:
 
163
 
164
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
165
  always_here_cols = [c.name for c in fields(AutoEvalColumn) if c.never_hidden]
166
+ # Use AutoEvalColumn.model.name directly if needed
167
+ filtered_df = df[always_here_cols + [c for c in COLS if c in df.columns and c in columns]]
 
 
 
168
  return filtered_df
169
 
 
170
  def filter_queries(query: str, df: pd.DataFrame):
171
  tmp_result_df = []
172
 
 
323
 
324
  leaderboard_table = gr.components.Dataframe(
325
  value=leaderboard_df[
326
+ [c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value
 
 
327
  ],
328
  headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
329
  datatype=TYPES,
330
  elem_id="leaderboard-table",
331
  interactive=False,
332
  visible=True,
 
333
  )
334
 
335
  # Dummy leaderboard for handling the case when the user uses backspace key
src/display/css_html_js.py CHANGED
@@ -1,9 +1,4 @@
1
  custom_css = """
2
- /* Hides the final AutoEvalColumn */
3
- #llm-benchmark-tab-table table td:last-child,
4
- #llm-benchmark-tab-table table th:last-child {
5
- display: none;
6
- }
7
 
8
  /* Limit the width of the first AutoEvalColumn so that names don't expand too much */
9
  table td:first-child,
@@ -44,7 +39,7 @@ table th:first-child {
44
  background: none;
45
  border: none;
46
  }
47
-
48
  #search-bar {
49
  padding: 0px;
50
  }
@@ -94,4 +89,4 @@ get_window_url_params = """
94
  url_params = Object.fromEntries(params);
95
  return url_params;
96
  }
97
- """
 
1
  custom_css = """
 
 
 
 
 
2
 
3
  /* Limit the width of the first AutoEvalColumn so that names don't expand too much */
4
  table td:first-child,
 
39
  background: none;
40
  border: none;
41
  }
42
+
43
  #search-bar {
44
  padding: 0px;
45
  }
 
89
  url_params = Object.fromEntries(params);
90
  return url_params;
91
  }
92
+ """
src/display/utils.py CHANGED
@@ -47,31 +47,29 @@ class ColumnContent:
47
  dummy: bool = False
48
 
49
 
50
- auto_eval_column_dict = []
51
- # Init
52
- auto_eval_column_dict.append(["model_type_symbol", ColumnContent, ColumnContent("T", "str", True, never_hidden=True)])
53
- auto_eval_column_dict.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
54
- # Scores
55
- auto_eval_column_dict.append(["average", ColumnContent, ColumnContent("Average ⬆️", "number", True)])
56
- for task in Tasks:
57
- auto_eval_column_dict.append([task.name, ColumnContent, ColumnContent(task.value.col_name, "number", True)])
58
- # Model information
59
- auto_eval_column_dict.append(["model_type", ColumnContent, ColumnContent("Type", "str", False)])
60
- auto_eval_column_dict.append(["architecture", ColumnContent, ColumnContent("Architecture", "str", False)])
61
- auto_eval_column_dict.append(["weight_type", ColumnContent, ColumnContent("Weight type", "str", False, True)])
62
- auto_eval_column_dict.append(["precision", ColumnContent, ColumnContent("Precision", "str", False)])
63
- auto_eval_column_dict.append(["merged", ColumnContent, ColumnContent("Merged", "bool", False)])
64
- auto_eval_column_dict.append(["license", ColumnContent, ColumnContent("Hub License", "str", False)])
65
- auto_eval_column_dict.append(["params", ColumnContent, ColumnContent("#Params (B)", "number", False)])
66
- auto_eval_column_dict.append(["likes", ColumnContent, ColumnContent("Hub ❤️", "number", False)])
67
- auto_eval_column_dict.append(
68
- ["still_on_hub", ColumnContent, ColumnContent("Available on the hub", "bool", False, hidden=True)]
69
- )
70
- auto_eval_column_dict.append(["revision", ColumnContent, ColumnContent("Model sha", "str", False, False)])
71
- auto_eval_column_dict.append(["flagged", ColumnContent, ColumnContent("Flagged", "bool", False, hidden=True)])
72
- auto_eval_column_dict.append(["moe", ColumnContent, ColumnContent("MoE", "bool", False, hidden=True)])
73
- # Dummy column for the search bar (hidden by the custom CSS)
74
- auto_eval_column_dict.append(["dummy", ColumnContent, ColumnContent("model_name_for_query", "str", False, dummy=True)])
75
 
76
  # We use make dataclass to dynamically fill the scores from Tasks
77
  AutoEvalColumn = make_dataclass("AutoEvalColumn", auto_eval_column_dict, frozen=True)
@@ -99,7 +97,6 @@ baseline_row = {
99
  AutoEvalColumn.truthfulqa.name: 25.0,
100
  AutoEvalColumn.winogrande.name: 50.0,
101
  AutoEvalColumn.gsm8k.name: 0.21,
102
- AutoEvalColumn.dummy.name: "baseline",
103
  AutoEvalColumn.model_type.name: "",
104
  AutoEvalColumn.flagged.name: False,
105
  }
@@ -124,7 +121,6 @@ human_baseline_row = {
124
  AutoEvalColumn.truthfulqa.name: 94.0,
125
  AutoEvalColumn.winogrande.name: 94.0,
126
  AutoEvalColumn.gsm8k.name: 100,
127
- AutoEvalColumn.dummy.name: "human_baseline",
128
  AutoEvalColumn.model_type.name: "",
129
  AutoEvalColumn.flagged.name: False,
130
  }
 
47
  dummy: bool = False
48
 
49
 
50
+ static_columns = [
51
+ ["model_type_symbol", ColumnContent, ColumnContent("T", "str", True, never_hidden=True)],
52
+ ["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)],
53
+ ["average", ColumnContent, ColumnContent("Average ⬆️", "number", True)],
54
+ ["model_type", ColumnContent, ColumnContent("Type", "str", False)],
55
+ ["architecture", ColumnContent, ColumnContent("Architecture", "str", False)],
56
+ ["weight_type", ColumnContent, ColumnContent("Weight type", "str", False, True)],
57
+ ["precision", ColumnContent, ColumnContent("Precision", "str", False)],
58
+ ["merged", ColumnContent, ColumnContent("Merged", "bool", False)],
59
+ ["license", ColumnContent, ColumnContent("Hub License", "str", False)],
60
+ ["params", ColumnContent, ColumnContent("#Params (B)", "number", False)],
61
+ ["likes", ColumnContent, ColumnContent("Hub ❤️", "number", False)],
62
+ ["still_on_hub", ColumnContent, ColumnContent("Available on the hub", "bool", False, hidden=True)],
63
+ ["revision", ColumnContent, ColumnContent("Model sha", "str", False, False)],
64
+ ["flagged", ColumnContent, ColumnContent("Flagged", "bool", False, hidden=True)],
65
+ ["moe", ColumnContent, ColumnContent("MoE", "bool", False, hidden=True)],
66
+ ]
67
+
68
+ # Append task specific columns using a comprehension
69
+ task_columns = [[task.name, ColumnContent, ColumnContent(task.value.col_name, "number", True)] for task in Tasks]
70
+
71
+ # Finally, combine them into one list
72
+ auto_eval_column_dict = static_columns + task_columns
 
 
73
 
74
  # We use make dataclass to dynamically fill the scores from Tasks
75
  AutoEvalColumn = make_dataclass("AutoEvalColumn", auto_eval_column_dict, frozen=True)
 
97
  AutoEvalColumn.truthfulqa.name: 25.0,
98
  AutoEvalColumn.winogrande.name: 50.0,
99
  AutoEvalColumn.gsm8k.name: 0.21,
 
100
  AutoEvalColumn.model_type.name: "",
101
  AutoEvalColumn.flagged.name: False,
102
  }
 
121
  AutoEvalColumn.truthfulqa.name: 94.0,
122
  AutoEvalColumn.winogrande.name: 94.0,
123
  AutoEvalColumn.gsm8k.name: 100,
 
124
  AutoEvalColumn.model_type.name: "",
125
  AutoEvalColumn.flagged.name: False,
126
  }
src/leaderboard/filter_models.py CHANGED
@@ -128,14 +128,11 @@ DO_NOT_SUBMIT_MODELS = [
128
  "TigerResearch/tigerbot-70b-chat-v4-4k", # per authors request
129
  ]
130
 
131
-
132
  def flag_models(leaderboard_data: list[dict]):
 
133
  for model_data in leaderboard_data:
134
- # Merges and moes are flagged automatically
135
- if model_data[AutoEvalColumn.flagged.name]:
136
- flag_key = "merged"
137
- else:
138
- flag_key = model_data["model_name_for_query"]
139
 
140
  if flag_key in FLAGGED_MODELS:
141
  issue_num = FLAGGED_MODELS[flag_key].split("/")[-1]
@@ -152,16 +149,18 @@ def flag_models(leaderboard_data: list[dict]):
152
 
153
 
154
  def remove_forbidden_models(leaderboard_data: list[dict]):
 
155
  indices_to_remove = []
156
  for ix, model in enumerate(leaderboard_data):
157
- if model["model_name_for_query"] in DO_NOT_SUBMIT_MODELS:
 
158
  indices_to_remove.append(ix)
159
 
 
160
  for ix in reversed(indices_to_remove):
161
  leaderboard_data.pop(ix)
162
  return leaderboard_data
163
 
164
-
165
  def filter_models_flags(leaderboard_data: list[dict]):
166
  leaderboard_data = remove_forbidden_models(leaderboard_data)
167
  flag_models(leaderboard_data)
 
128
  "TigerResearch/tigerbot-70b-chat-v4-4k", # per authors request
129
  ]
130
 
 
131
  def flag_models(leaderboard_data: list[dict]):
132
+ """Flags models based on external criteria or flagged status."""
133
  for model_data in leaderboard_data:
134
+ # Use the primary model name for checking flags
135
+ flag_key = model_data[AutoEvalColumn.model.name] # Use the direct model name
 
 
 
136
 
137
  if flag_key in FLAGGED_MODELS:
138
  issue_num = FLAGGED_MODELS[flag_key].split("/")[-1]
 
149
 
150
 
151
  def remove_forbidden_models(leaderboard_data: list[dict]):
152
+ """Removes models from the leaderboard based on the DO_NOT_SUBMIT list."""
153
  indices_to_remove = []
154
  for ix, model in enumerate(leaderboard_data):
155
+ # Use the correct field that now holds the model name
156
+ if model[AutoEvalColumn.model.name] in DO_NOT_SUBMIT_MODELS:
157
  indices_to_remove.append(ix)
158
 
159
+ # Remove the models from the list
160
  for ix in reversed(indices_to_remove):
161
  leaderboard_data.pop(ix)
162
  return leaderboard_data
163
 
 
164
  def filter_models_flags(leaderboard_data: list[dict]):
165
  leaderboard_data = remove_forbidden_models(leaderboard_data)
166
  flag_models(leaderboard_data)
src/leaderboard/read_evals.py CHANGED
@@ -133,7 +133,6 @@ class EvalResult:
133
  AutoEvalColumn.weight_type.name: self.weight_type.value.name,
134
  AutoEvalColumn.architecture.name: self.architecture,
135
  AutoEvalColumn.model.name: make_clickable_model(self.full_model),
136
- AutoEvalColumn.dummy.name: self.full_model,
137
  AutoEvalColumn.revision.name: self.revision,
138
  AutoEvalColumn.average.name: average,
139
  AutoEvalColumn.license.name: self.license,
 
133
  AutoEvalColumn.weight_type.name: self.weight_type.value.name,
134
  AutoEvalColumn.architecture.name: self.architecture,
135
  AutoEvalColumn.model.name: make_clickable_model(self.full_model),
 
136
  AutoEvalColumn.revision.name: self.revision,
137
  AutoEvalColumn.average.name: average,
138
  AutoEvalColumn.license.name: self.license,
src/tools/collections.py CHANGED
@@ -60,7 +60,7 @@ def update_collections(df: DataFrame):
60
  for size, interval in intervals.items():
61
  filtered_df = _filter_by_type_and_size(df, model_type, interval)
62
  best_models = list(
63
- filtered_df.sort_values(AutoEvalColumn.average.name, ascending=False)[AutoEvalColumn.dummy.name][:10]
64
  )
65
  print(model_type.value.symbol, size, best_models)
66
  _add_models_to_collection(collection, best_models, model_type, size)
@@ -73,4 +73,4 @@ def update_collections(df: DataFrame):
73
  try:
74
  delete_collection_item(collection_slug=PATH_TO_COLLECTION, item_object_id=item_id, token=H4_TOKEN)
75
  except HfHubHTTPError:
76
- continue
 
60
  for size, interval in intervals.items():
61
  filtered_df = _filter_by_type_and_size(df, model_type, interval)
62
  best_models = list(
63
+ filtered_df.sort_values(AutoEvalColumn.average.name, ascending=False)[AutoEvalColumn.model.name][:10]
64
  )
65
  print(model_type.value.symbol, size, best_models)
66
  _add_models_to_collection(collection, best_models, model_type, size)
 
73
  try:
74
  delete_collection_item(collection_slug=PATH_TO_COLLECTION, item_object_id=item_id, token=H4_TOKEN)
75
  except HfHubHTTPError:
76
+ continue