Added model API to submission screen
Browse files- app.py +10 -1
- src/display/utils.py +7 -0
- src/submission/submit.py +5 -0
app.py
CHANGED
@@ -22,6 +22,7 @@ from src.display.utils import (
|
|
22 |
TYPES,
|
23 |
AutoEvalColumn,
|
24 |
ModelType,
|
|
|
25 |
fields,
|
26 |
WeightType,
|
27 |
Precision
|
@@ -287,6 +288,13 @@ with demo:
|
|
287 |
|
288 |
with gr.Row():
|
289 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
model_name_textbox = gr.Textbox(label="Model name")
|
291 |
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
292 |
model_type = gr.Dropdown(
|
@@ -319,6 +327,7 @@ with demo:
|
|
319 |
submit_button.click(
|
320 |
add_new_eval,
|
321 |
[
|
|
|
322 |
model_name_textbox,
|
323 |
base_model_name_textbox,
|
324 |
revision_name_textbox,
|
@@ -342,4 +351,4 @@ with demo:
|
|
342 |
scheduler = BackgroundScheduler()
|
343 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
344 |
scheduler.start()
|
345 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
22 |
TYPES,
|
23 |
AutoEvalColumn,
|
24 |
ModelType,
|
25 |
+
ModelAPI,
|
26 |
fields,
|
27 |
WeightType,
|
28 |
Precision
|
|
|
288 |
|
289 |
with gr.Row():
|
290 |
with gr.Column():
|
291 |
+
model_api = gr.Dropdown(
|
292 |
+
choices=[a.value.api for a in ModelAPI],
|
293 |
+
label="Model API",
|
294 |
+
multiselect=False,
|
295 |
+
value="hf",
|
296 |
+
interactive=True,
|
297 |
+
)
|
298 |
model_name_textbox = gr.Textbox(label="Model name")
|
299 |
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
300 |
model_type = gr.Dropdown(
|
|
|
327 |
submit_button.click(
|
328 |
add_new_eval,
|
329 |
[
|
330 |
+
model_api,
|
331 |
model_name_textbox,
|
332 |
base_model_name_textbox,
|
333 |
revision_name_textbox,
|
|
|
351 |
scheduler = BackgroundScheduler()
|
352 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
353 |
scheduler.start()
|
354 |
+
demo.queue(default_concurrency_limit=40).launch()
|
src/display/utils.py
CHANGED
@@ -56,11 +56,18 @@ class EvalQueueColumn: # Queue column
|
|
56 |
## All the model information that we might need
|
57 |
@dataclass
|
58 |
class ModelDetails:
|
|
|
59 |
name: str
|
60 |
display_name: str = ""
|
61 |
symbol: str = "" # emoji
|
62 |
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
class ModelType(Enum):
|
65 |
PT = ModelDetails(name="pretrained", symbol="🟢")
|
66 |
FT = ModelDetails(name="fine-tuned", symbol="🔶")
|
|
|
56 |
## All the model information that we might need
|
57 |
@dataclass
|
58 |
class ModelDetails:
|
59 |
+
api: str
|
60 |
name: str
|
61 |
display_name: str = ""
|
62 |
symbol: str = "" # emoji
|
63 |
|
64 |
|
65 |
+
class ModelAPI(Enum):
|
66 |
+
hf = ModelDetails(name="", api="hf")
|
67 |
+
openai = ModelDetails(name="", api="openai-chat-completions")
|
68 |
+
anthropic = ModelDetails(name="", api="anthropic-chat-completions")
|
69 |
+
|
70 |
+
|
71 |
class ModelType(Enum):
|
72 |
PT = ModelDetails(name="pretrained", symbol="🟢")
|
73 |
FT = ModelDetails(name="fine-tuned", symbol="🔶")
|
src/submission/submit.py
CHANGED
@@ -15,6 +15,7 @@ REQUESTED_MODELS = None
|
|
15 |
USERS_TO_SUBMISSION_DATES = None
|
16 |
|
17 |
def add_new_eval(
|
|
|
18 |
model: str,
|
19 |
base_model: str,
|
20 |
revision: str,
|
@@ -36,6 +37,9 @@ def add_new_eval(
|
|
36 |
precision = precision.split(" ")[0]
|
37 |
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
38 |
|
|
|
|
|
|
|
39 |
if model_type is None or model_type == "":
|
40 |
return styled_error("Please select a model type.")
|
41 |
|
@@ -76,6 +80,7 @@ def add_new_eval(
|
|
76 |
print("Adding new eval")
|
77 |
|
78 |
eval_entry = {
|
|
|
79 |
"model": model,
|
80 |
"base_model": base_model,
|
81 |
"revision": revision,
|
|
|
15 |
USERS_TO_SUBMISSION_DATES = None
|
16 |
|
17 |
def add_new_eval(
|
18 |
+
model_api: str,
|
19 |
model: str,
|
20 |
base_model: str,
|
21 |
revision: str,
|
|
|
37 |
precision = precision.split(" ")[0]
|
38 |
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
39 |
|
40 |
+
if model_api not in ["hf", "openai-chat-completions", "anthropic-chat-completions"]:
|
41 |
+
return styled_error('Please select a model API from one of "hf", "openai-chat-completions" or "anthropic-chat-completions"')
|
42 |
+
|
43 |
if model_type is None or model_type == "":
|
44 |
return styled_error("Please select a model type.")
|
45 |
|
|
|
80 |
print("Adding new eval")
|
81 |
|
82 |
eval_entry = {
|
83 |
+
"model_api": model_api,
|
84 |
"model": model,
|
85 |
"base_model": base_model,
|
86 |
"revision": revision,
|