Sean Cho commited on
Commit
7389820
1 Parent(s): ae1c702

restrict model size

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import json
2
  import os
3
  from datetime import datetime, timezone
 
4
 
5
  import gradio as gr
6
  import pandas as pd
@@ -117,8 +118,17 @@ leaderboard_df = original_df.copy()
117
  pending_eval_queue_df,
118
  ) = get_evaluation_queue_df(eval_queue, eval_queue_private, EVAL_REQUESTS_PATH, EVAL_COLS)
119
 
120
-
121
  ## INTERACTION FUNCTIONS
 
 
 
 
 
 
 
 
 
 
122
  def add_new_eval(
123
  model: str,
124
  base_model: str,
@@ -128,6 +138,9 @@ def add_new_eval(
128
  weight_type: str,
129
  model_type: str,
130
  ):
 
 
 
131
  precision = precision.split(" ")[0]
132
  current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
133
 
@@ -526,6 +539,7 @@ with demo:
526
  base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
527
 
528
  submit_button = gr.Button("Submit Evalulation!")
 
529
  submission_result = gr.Markdown()
530
  submit_button.click(
531
  add_new_eval,
 
1
  import json
2
  import os
3
  from datetime import datetime, timezone
4
+ import re
5
 
6
  import gradio as gr
7
  import pandas as pd
 
118
  pending_eval_queue_df,
119
  ) = get_evaluation_queue_df(eval_queue, eval_queue_private, EVAL_REQUESTS_PATH, EVAL_COLS)
120
 
 
121
  ## INTERACTION FUNCTIONS
122
+ def is_model_acceptable(model: str) -> bool:
123
+ # regex for something like '13b'
124
+ pattern = r'(\d+)[bB]'
125
+ values = re.findall(pattern, model)
126
+ for val in values:
127
+ if int(val) <= 13:
128
+ return True
129
+
130
+ return values == []
131
+
132
  def add_new_eval(
133
  model: str,
134
  base_model: str,
 
138
  weight_type: str,
139
  model_type: str,
140
  ):
141
+ if not is_model_acceptable(model):
142
+ return styled_error("Please submit a model with less than 13B parameters.")
143
+
144
  precision = precision.split(" ")[0]
145
  current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
146
 
 
539
  base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
540
 
541
  submit_button = gr.Button("Submit Evalulation!")
542
+ gr.Markdown("_We accept models with less than or equal to 13B parameters now._")
543
  submission_result = gr.Markdown()
544
  submit_button.click(
545
  add_new_eval,