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

enhanced naming of dummy column

Browse files
app.py CHANGED
@@ -154,17 +154,15 @@ 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.model.name].str.contains(query, case=False, na=False))]
158
-
159
 
160
  def search_license(df: pd.DataFrame, query: str) -> pd.DataFrame:
161
  return df[df[AutoEvalColumn.license.name].str.contains(query, case=False, na=False)]
162
 
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):
@@ -323,7 +321,9 @@ with demo:
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,
 
154
 
155
 
156
  def search_model(df: pd.DataFrame, query: str) -> pd.DataFrame:
157
+ return df[(df[AutoEvalColumn.fullname.name].str.contains(query, case=False, na=False))]
 
158
 
159
  def search_license(df: pd.DataFrame, query: str) -> pd.DataFrame:
160
  return df[df[AutoEvalColumn.license.name].str.contains(query, case=False, na=False)]
161
 
 
162
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
163
  always_here_cols = [c.name for c in fields(AutoEvalColumn) if c.never_hidden]
164
+ dummy_col = [AutoEvalColumn.fullname.name]
165
+ filtered_df = df[always_here_cols + [c for c in COLS if c in df.columns and c in columns] + dummy_col]
166
  return filtered_df
167
 
168
  def filter_queries(query: str, df: pd.DataFrame):
 
321
 
322
  leaderboard_table = gr.components.Dataframe(
323
  value=leaderboard_df[
324
+ [c.name for c in fields(AutoEvalColumn) if c.never_hidden]
325
+ + shown_columns.value
326
+ + [AutoEvalColumn.fullname.name]
327
  ],
328
  headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
329
  datatype=TYPES,
src/display/css_html_js.py CHANGED
@@ -1,5 +1,11 @@
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,
5
  table th:first-child {
 
1
  custom_css = """
2
 
3
+ /* Hides the final AutoEvalColumn */
4
+ #llm-benchmark-tab-table table td:last-child,
5
+ #llm-benchmark-tab-table table th:last-child {
6
+ display: none;
7
+ }
8
+
9
  /* Limit the width of the first AutoEvalColumn so that names don't expand too much */
10
  table td:first-child,
11
  table th:first-child {
src/display/utils.py CHANGED
@@ -47,34 +47,37 @@ class ColumnContent:
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)
76
 
77
 
 
78
  @dataclass(frozen=True)
79
  class EvalQueueColumn: # Queue column
80
  model = ColumnContent("model", "markdown", True)
@@ -97,6 +100,7 @@ baseline_row = {
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,6 +125,7 @@ human_baseline_row = {
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
  }
 
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(["fullname", ColumnContent, ColumnContent("fullname", "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)
78
 
79
 
80
+
81
  @dataclass(frozen=True)
82
  class EvalQueueColumn: # Queue column
83
  model = ColumnContent("model", "markdown", True)
 
100
  AutoEvalColumn.truthfulqa.name: 25.0,
101
  AutoEvalColumn.winogrande.name: 50.0,
102
  AutoEvalColumn.gsm8k.name: 0.21,
103
+ AutoEvalColumn.fullname.name: "baseline",
104
  AutoEvalColumn.model_type.name: "",
105
  AutoEvalColumn.flagged.name: False,
106
  }
 
125
  AutoEvalColumn.truthfulqa.name: 94.0,
126
  AutoEvalColumn.winogrande.name: 94.0,
127
  AutoEvalColumn.gsm8k.name: 100,
128
+ AutoEvalColumn.fullname.name: "human_baseline",
129
  AutoEvalColumn.model_type.name: "",
130
  AutoEvalColumn.flagged.name: False,
131
  }
src/leaderboard/filter_models.py CHANGED
@@ -128,13 +128,19 @@ DO_NOT_SUBMIT_MODELS = [
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]
139
  issue_link = model_hyperlink(
140
  FLAGGED_MODELS[flag_key],
@@ -152,8 +158,7 @@ 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
@@ -161,6 +166,8 @@ def remove_forbidden_models(leaderboard_data: list[dict]):
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)
 
 
128
  "TigerResearch/tigerbot-70b-chat-v4-4k", # per authors request
129
  ]
130
 
131
+
132
  def flag_models(leaderboard_data: list[dict]):
133
  """Flags models based on external criteria or flagged status."""
134
  for model_data in leaderboard_data:
135
+ # Merges and moes are flagged automatically
136
+ if model_data[AutoEvalColumn.flagged.name]:
137
+ flag_key = "merged"
138
+ else:
139
+ flag_key = model_data[AutoEvalColumn.fullname.name]
140
 
141
+ print(f"model check: {flag_key}")
142
  if flag_key in FLAGGED_MODELS:
143
+ print(f"Flagged model: {flag_key}")
144
  issue_num = FLAGGED_MODELS[flag_key].split("/")[-1]
145
  issue_link = model_hyperlink(
146
  FLAGGED_MODELS[flag_key],
 
158
  """Removes models from the leaderboard based on the DO_NOT_SUBMIT list."""
159
  indices_to_remove = []
160
  for ix, model in enumerate(leaderboard_data):
161
+ if model[AutoEvalColumn.fullname.name] in DO_NOT_SUBMIT_MODELS:
 
162
  indices_to_remove.append(ix)
163
 
164
  # Remove the models from the list
 
166
  leaderboard_data.pop(ix)
167
  return leaderboard_data
168
 
169
+
170
  def filter_models_flags(leaderboard_data: list[dict]):
171
  leaderboard_data = remove_forbidden_models(leaderboard_data)
172
  flag_models(leaderboard_data)
173
+
src/leaderboard/read_evals.py CHANGED
@@ -133,6 +133,7 @@ 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.revision.name: self.revision,
137
  AutoEvalColumn.average.name: average,
138
  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.fullname.name: self.full_model,
137
  AutoEvalColumn.revision.name: self.revision,
138
  AutoEvalColumn.average.name: average,
139
  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.model.name][:10]
64
  )
65
  print(model_type.value.symbol, size, best_models)
66
  _add_models_to_collection(collection, best_models, model_type, size)
 
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.fullname.name][:10]
64
  )
65
  print(model_type.value.symbol, size, best_models)
66
  _add_models_to_collection(collection, best_models, model_type, size)