Nathan Habib commited on
Commit
e3a8804
1 Parent(s): a44ac97

add precision selector

Browse files
Files changed (1) hide show
  1. app.py +40 -9
app.py CHANGED
@@ -112,6 +112,8 @@ leaderboard_df = original_df.copy()
112
  pending_eval_queue_df,
113
  ) = get_evaluation_queue_df(eval_queue, eval_queue_private, EVAL_REQUESTS_PATH, EVAL_COLS)
114
 
 
 
115
 
116
  ## INTERACTION FUNCTIONS
117
  def add_new_eval(
@@ -214,8 +216,8 @@ def change_tab(query_param: str):
214
 
215
 
216
  # Searching and filtering
217
- def update_table(hidden_df: pd.DataFrame, current_columns_df: pd.DataFrame, columns: list, type_query: list, size_query: list, show_deleted: bool, query: str):
218
- filtered_df = filter_models(hidden_df, type_query, size_query, show_deleted)
219
  if query != "":
220
  filtered_df = search_table(filtered_df, query)
221
  df = select_columns(filtered_df, columns)
@@ -247,16 +249,17 @@ NUMERIC_INTERVALS = {
247
  }
248
 
249
  def filter_models(
250
- df: pd.DataFrame, type_query: list, size_query: list, show_deleted: bool
251
  ) -> pd.DataFrame:
252
  # Show all models
253
  if show_deleted:
254
  filtered_df = df
255
  else: # Show only still on the hub models
256
- filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
257
 
258
  type_emoji = [t[0] for t in type_query]
259
  filtered_df = filtered_df[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
 
260
 
261
  numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
262
  params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
@@ -275,6 +278,12 @@ with demo:
275
  with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
276
  with gr.Row():
277
  with gr.Column():
 
 
 
 
 
 
278
  with gr.Row():
279
  shown_columns = gr.CheckboxGroup(
280
  choices=[
@@ -308,11 +317,6 @@ with demo:
308
  value=True, label="Show gated/private/deleted models", interactive=True
309
  )
310
  with gr.Column(min_width=320):
311
- search_bar = gr.Textbox(
312
- placeholder="🔍 Search for your model and press ENTER...",
313
- show_label=False,
314
- elem_id="search-bar",
315
- )
316
  with gr.Box(elem_id="box-filter"):
317
  filter_columns_type = gr.CheckboxGroup(
318
  label="Model types",
@@ -331,6 +335,13 @@ with demo:
331
  interactive=True,
332
  elem_id="filter-columns-type",
333
  )
 
 
 
 
 
 
 
334
  filter_columns_size = gr.CheckboxGroup(
335
  label="Model sizes",
336
  choices=list(NUMERIC_INTERVALS.keys()),
@@ -373,6 +384,7 @@ with demo:
373
  leaderboard_table,
374
  shown_columns,
375
  filter_columns_type,
 
376
  filter_columns_size,
377
  deleted_models_visibility,
378
  search_bar,
@@ -386,6 +398,7 @@ with demo:
386
  leaderboard_table,
387
  shown_columns,
388
  filter_columns_type,
 
389
  filter_columns_size,
390
  deleted_models_visibility,
391
  search_bar,
@@ -400,6 +413,22 @@ with demo:
400
  leaderboard_table,
401
  shown_columns,
402
  filter_columns_type,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  filter_columns_size,
404
  deleted_models_visibility,
405
  search_bar,
@@ -414,6 +443,7 @@ with demo:
414
  leaderboard_table,
415
  shown_columns,
416
  filter_columns_type,
 
417
  filter_columns_size,
418
  deleted_models_visibility,
419
  search_bar,
@@ -428,6 +458,7 @@ with demo:
428
  leaderboard_table,
429
  shown_columns,
430
  filter_columns_type,
 
431
  filter_columns_size,
432
  deleted_models_visibility,
433
  search_bar,
 
112
  pending_eval_queue_df,
113
  ) = get_evaluation_queue_df(eval_queue, eval_queue_private, EVAL_REQUESTS_PATH, EVAL_COLS)
114
 
115
+ print(leaderboard_df["Precision"].unique())
116
+
117
 
118
  ## INTERACTION FUNCTIONS
119
  def add_new_eval(
 
216
 
217
 
218
  # Searching and filtering
219
+ def update_table(hidden_df: pd.DataFrame, current_columns_df: pd.DataFrame, columns: list, type_query: list, precision_query: str, size_query: list, show_deleted: bool, query: str):
220
+ filtered_df = filter_models(hidden_df, type_query, size_query, precision_query, show_deleted)
221
  if query != "":
222
  filtered_df = search_table(filtered_df, query)
223
  df = select_columns(filtered_df, columns)
 
249
  }
250
 
251
  def filter_models(
252
+ df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
253
  ) -> pd.DataFrame:
254
  # Show all models
255
  if show_deleted:
256
  filtered_df = df
257
  else: # Show only still on the hub models
258
+ filtered_df = df[df[AutoEvalColumn.still_on_hub.name] is True]
259
 
260
  type_emoji = [t[0] for t in type_query]
261
  filtered_df = filtered_df[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
262
+ filtered_df = filtered_df[df[AutoEvalColumn.precision.name].isin(precision_query)]
263
 
264
  numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
265
  params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
 
278
  with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
279
  with gr.Row():
280
  with gr.Column():
281
+ with gr.Row():
282
+ search_bar = gr.Textbox(
283
+ placeholder=" 🔍 Search for your model and press ENTER...",
284
+ show_label=False,
285
+ elem_id="search-bar",
286
+ )
287
  with gr.Row():
288
  shown_columns = gr.CheckboxGroup(
289
  choices=[
 
317
  value=True, label="Show gated/private/deleted models", interactive=True
318
  )
319
  with gr.Column(min_width=320):
 
 
 
 
 
320
  with gr.Box(elem_id="box-filter"):
321
  filter_columns_type = gr.CheckboxGroup(
322
  label="Model types",
 
335
  interactive=True,
336
  elem_id="filter-columns-type",
337
  )
338
+ filter_columns_precision = gr.CheckboxGroup(
339
+ label="Precision",
340
+ choices=["torch.float16", "torch.bfloat16", "torch.float32", "8bit", "4bit", "GPTQ"],
341
+ value=["torch.float16", "torch.bfloat16", "torch.float32", "8bit", "4bit", "GPTQ"],
342
+ interactive=True,
343
+ elem_id="filter-columns-precision",
344
+ )
345
  filter_columns_size = gr.CheckboxGroup(
346
  label="Model sizes",
347
  choices=list(NUMERIC_INTERVALS.keys()),
 
384
  leaderboard_table,
385
  shown_columns,
386
  filter_columns_type,
387
+ filter_columns_precision,
388
  filter_columns_size,
389
  deleted_models_visibility,
390
  search_bar,
 
398
  leaderboard_table,
399
  shown_columns,
400
  filter_columns_type,
401
+ filter_columns_precision,
402
  filter_columns_size,
403
  deleted_models_visibility,
404
  search_bar,
 
413
  leaderboard_table,
414
  shown_columns,
415
  filter_columns_type,
416
+ filter_columns_precision,
417
+ filter_columns_size,
418
+ deleted_models_visibility,
419
+ search_bar,
420
+ ],
421
+ leaderboard_table,
422
+ queue=True,
423
+ )
424
+ filter_columns_precision.change(
425
+ update_table,
426
+ [
427
+ hidden_leaderboard_table_for_search,
428
+ leaderboard_table,
429
+ shown_columns,
430
+ filter_columns_type,
431
+ filter_columns_precision,
432
  filter_columns_size,
433
  deleted_models_visibility,
434
  search_bar,
 
443
  leaderboard_table,
444
  shown_columns,
445
  filter_columns_type,
446
+ filter_columns_precision,
447
  filter_columns_size,
448
  deleted_models_visibility,
449
  search_bar,
 
458
  leaderboard_table,
459
  shown_columns,
460
  filter_columns_type,
461
+ filter_columns_precision,
462
  filter_columns_size,
463
  deleted_models_visibility,
464
  search_bar,