update: submit file
Browse files- src/submission/submit.py +9 -7
src/submission/submit.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
-
import gradio as gr
|
2 |
import json
|
3 |
import os
|
4 |
from datetime import datetime, timezone
|
|
|
|
|
5 |
from src.display.formatting import styled_error, styled_message
|
6 |
from src.envs import API, EVAL_REQUESTS_PATH, QUEUE_REPO
|
7 |
|
|
|
8 |
def add_new_eval(model: str, weight_type: str, gguf_filename=None):
|
9 |
user_name = ""
|
10 |
model_path = model
|
@@ -23,9 +25,10 @@ def add_new_eval(model: str, weight_type: str, gguf_filename=None):
|
|
23 |
if weight_type == "safetensors":
|
24 |
if gguf_filename:
|
25 |
return styled_error("GGUF filename should not be provided when using safetensors.")
|
26 |
-
gguf_filename = None # Ensure gguf_filename is None when safetensors is selected
|
27 |
|
28 |
-
#
|
|
|
|
|
29 |
eval_entry = {
|
30 |
"model": model,
|
31 |
"weight_type": weight_type,
|
@@ -34,7 +37,7 @@ def add_new_eval(model: str, weight_type: str, gguf_filename=None):
|
|
34 |
"submitted_time": current_time,
|
35 |
}
|
36 |
|
37 |
-
|
38 |
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{user_name}"
|
39 |
os.makedirs(OUT_DIR, exist_ok=True)
|
40 |
out_path = f"{OUT_DIR}/{model_path}_eval_request_{current_time}.json"
|
@@ -42,7 +45,7 @@ def add_new_eval(model: str, weight_type: str, gguf_filename=None):
|
|
42 |
with open(out_path, "w") as f:
|
43 |
f.write(json.dumps(eval_entry))
|
44 |
|
45 |
-
|
46 |
API.upload_file(
|
47 |
path_or_fileobj=out_path,
|
48 |
path_in_repo=out_path.split("eval-queue/")[1],
|
@@ -68,8 +71,7 @@ with gr.Blocks() as demo:
|
|
68 |
label="Weight Type",
|
69 |
choices=["default", "safetensors", "other"],
|
70 |
value="default",
|
71 |
-
interactive=True
|
72 |
-
elem_id="weight-type-dropdown"
|
73 |
)
|
74 |
gguf_filename_input = gr.Textbox(label="GGUF Filename", interactive=True)
|
75 |
submit_btn = gr.Button("Submit")
|
|
|
|
|
1 |
import json
|
2 |
import os
|
3 |
from datetime import datetime, timezone
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
from src.display.formatting import styled_error, styled_message
|
7 |
from src.envs import API, EVAL_REQUESTS_PATH, QUEUE_REPO
|
8 |
|
9 |
+
|
10 |
def add_new_eval(model: str, weight_type: str, gguf_filename=None):
|
11 |
user_name = ""
|
12 |
model_path = model
|
|
|
25 |
if weight_type == "safetensors":
|
26 |
if gguf_filename:
|
27 |
return styled_error("GGUF filename should not be provided when using safetensors.")
|
|
|
28 |
|
29 |
+
# Seems good, creating the eval
|
30 |
+
print("Adding new eval")
|
31 |
+
|
32 |
eval_entry = {
|
33 |
"model": model,
|
34 |
"weight_type": weight_type,
|
|
|
37 |
"submitted_time": current_time,
|
38 |
}
|
39 |
|
40 |
+
print("Creating eval file")
|
41 |
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{user_name}"
|
42 |
os.makedirs(OUT_DIR, exist_ok=True)
|
43 |
out_path = f"{OUT_DIR}/{model_path}_eval_request_{current_time}.json"
|
|
|
45 |
with open(out_path, "w") as f:
|
46 |
f.write(json.dumps(eval_entry))
|
47 |
|
48 |
+
print("Uploading eval file")
|
49 |
API.upload_file(
|
50 |
path_or_fileobj=out_path,
|
51 |
path_in_repo=out_path.split("eval-queue/")[1],
|
|
|
71 |
label="Weight Type",
|
72 |
choices=["default", "safetensors", "other"],
|
73 |
value="default",
|
74 |
+
interactive=True
|
|
|
75 |
)
|
76 |
gguf_filename_input = gr.Textbox(label="GGUF Filename", interactive=True)
|
77 |
submit_btn = gr.Button("Submit")
|