t0-0 commited on
Commit
9c999fc
1 Parent(s): 6ef2c5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -23,6 +23,7 @@ from src.display.utils import (
23
  WeightType,
24
  Precision,
25
  AddSpecialTokens,
 
26
  NUMERIC_INTERVALS,
27
  TYPES,
28
  )
@@ -69,12 +70,13 @@ def update_table(
69
  precision_query: str,
70
  size_query: list,
71
  add_special_tokens_query: list,
 
72
  show_deleted: bool,
73
  show_merges: bool,
74
  show_flagged: bool,
75
  query: str,
76
  ):
77
- filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, add_special_tokens_query, show_deleted, show_merges, show_flagged)
78
  filtered_df = filter_queries(query, filtered_df)
79
  df = select_columns(filtered_df, columns)
80
  return df
@@ -122,7 +124,7 @@ def filter_queries(query: str, filtered_df: pd.DataFrame):
122
 
123
 
124
  def filter_models(
125
- df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, add_special_tokens_query: list, show_deleted: bool, show_merges: bool, show_flagged: bool
126
  ) -> pd.DataFrame:
127
  # Show all models
128
  if show_deleted:
@@ -140,6 +142,7 @@ def filter_models(
140
  filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
141
  filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
142
  filtered_df = filtered_df.loc[df[AutoEvalColumn.add_special_tokens.name].isin(add_special_tokens_query)]
 
143
 
144
 
145
  numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
@@ -148,7 +151,7 @@ def filter_models(
148
  filtered_df = filtered_df.loc[mask]
149
  return filtered_df
150
 
151
- leaderboard_df = filter_models(leaderboard_df, [t.to_str(" : ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], False, False, False)
152
 
153
  demo = gr.Blocks(css=custom_css)
154
  with demo:
@@ -221,6 +224,13 @@ with demo:
221
  interactive=True,
222
  elem_id="filter-columns-add-special-tokens",
223
  )
 
 
 
 
 
 
 
224
 
225
  leaderboard_table = gr.components.Dataframe(
226
  value=leaderboard_df[
@@ -252,6 +262,7 @@ with demo:
252
  filter_columns_precision,
253
  filter_columns_size,
254
  filter_columns_add_special_tokens,
 
255
  deleted_models_visibility,
256
  merged_models_visibility,
257
  flagged_models_visibility,
@@ -271,6 +282,7 @@ with demo:
271
  filter_columns_precision,
272
  filter_columns_size,
273
  filter_columns_add_special_tokens,
 
274
  deleted_models_visibility,
275
  merged_models_visibility,
276
  flagged_models_visibility,
@@ -281,7 +293,7 @@ with demo:
281
  # Check query parameter once at startup and update search bar + hidden component
282
  demo.load(load_query, inputs=[], outputs=[search_bar, hidden_search_bar])
283
 
284
- for selector in [shown_columns, filter_columns_type, filter_columns_precision, filter_columns_size, filter_columns_add_special_tokens, deleted_models_visibility, merged_models_visibility, flagged_models_visibility]:
285
  selector.change(
286
  update_table,
287
  [
@@ -291,6 +303,7 @@ with demo:
291
  filter_columns_precision,
292
  filter_columns_size,
293
  filter_columns_add_special_tokens,
 
294
  deleted_models_visibility,
295
  merged_models_visibility,
296
  flagged_models_visibility,
 
23
  WeightType,
24
  Precision,
25
  AddSpecialTokens,
26
+ NumFewShots,
27
  NUMERIC_INTERVALS,
28
  TYPES,
29
  )
 
70
  precision_query: str,
71
  size_query: list,
72
  add_special_tokens_query: list,
73
+ num_few_shots_query: list,
74
  show_deleted: bool,
75
  show_merges: bool,
76
  show_flagged: bool,
77
  query: str,
78
  ):
79
+ filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, add_special_tokens_query, num_few_shots_query, show_deleted, show_merges, show_flagged)
80
  filtered_df = filter_queries(query, filtered_df)
81
  df = select_columns(filtered_df, columns)
82
  return df
 
124
 
125
 
126
  def filter_models(
127
+ df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, add_special_tokens_query: list, num_few_shots_query: list, show_deleted: bool, show_merges: bool, show_flagged: bool
128
  ) -> pd.DataFrame:
129
  # Show all models
130
  if show_deleted:
 
142
  filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
143
  filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
144
  filtered_df = filtered_df.loc[df[AutoEvalColumn.add_special_tokens.name].isin(add_special_tokens_query)]
145
+ filtered_df = filtered_df.loc[df[AutoEvalColumn.num_few_shots.name].isin(num_few_shots_query)]
146
 
147
 
148
  numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
 
151
  filtered_df = filtered_df.loc[mask]
152
  return filtered_df
153
 
154
+ leaderboard_df = filter_models(leaderboard_df, [t.to_str(" : ") for t in ModelType], list(NUMERIC_INTERVALS.keys()), [i.value.name for i in Precision], [i.value.name for i in AddSpecialTokens], [i.value.name for i in NumFewShots], False, False, False)
155
 
156
  demo = gr.Blocks(css=custom_css)
157
  with demo:
 
224
  interactive=True,
225
  elem_id="filter-columns-add-special-tokens",
226
  )
227
+ filter_columns_num_few_shots = gr.CheckboxGroup(
228
+ label="Num Few Shots",
229
+ choices=[i.value.name for i in NumFewShots],
230
+ value=[i.value.name for i in NumFewShots],
231
+ interactive=True,
232
+ elem_id="filter-columns-num-few-shots",
233
+ )
234
 
235
  leaderboard_table = gr.components.Dataframe(
236
  value=leaderboard_df[
 
262
  filter_columns_precision,
263
  filter_columns_size,
264
  filter_columns_add_special_tokens,
265
+ filter_columns_num_few_shots,
266
  deleted_models_visibility,
267
  merged_models_visibility,
268
  flagged_models_visibility,
 
282
  filter_columns_precision,
283
  filter_columns_size,
284
  filter_columns_add_special_tokens,
285
+ filter_columns_num_few_shots,
286
  deleted_models_visibility,
287
  merged_models_visibility,
288
  flagged_models_visibility,
 
293
  # Check query parameter once at startup and update search bar + hidden component
294
  demo.load(load_query, inputs=[], outputs=[search_bar, hidden_search_bar])
295
 
296
+ for selector in [shown_columns, filter_columns_type, filter_columns_precision, filter_columns_size, filter_columns_add_special_tokens, filter_columns_num_few_shots, deleted_models_visibility, merged_models_visibility, flagged_models_visibility]:
297
  selector.change(
298
  update_table,
299
  [
 
303
  filter_columns_precision,
304
  filter_columns_size,
305
  filter_columns_add_special_tokens,
306
+ filter_columns_num_few_shots,
307
  deleted_models_visibility,
308
  merged_models_visibility,
309
  flagged_models_visibility,