Spaces:
Running
Running
Update app.py
Browse filesremoving precision for now
app.py
CHANGED
|
@@ -35,22 +35,6 @@ class WeightType(Enum):
|
|
| 35 |
Original = ModelDetails("Original")
|
| 36 |
Delta = ModelDetails("Delta")
|
| 37 |
|
| 38 |
-
class Precision(Enum):
|
| 39 |
-
float16 = ModelDetails("float16")
|
| 40 |
-
bfloat16 = ModelDetails("bfloat16")
|
| 41 |
-
float32 = ModelDetails("float32")
|
| 42 |
-
bfloat32 = ModelDetails("bfloat32")
|
| 43 |
-
Unknown = ModelDetails("?")
|
| 44 |
-
|
| 45 |
-
def from_str(precision):
|
| 46 |
-
if precision in ["torch.float16", "float16"]:
|
| 47 |
-
return Precision.float16
|
| 48 |
-
if precision in ["torch.bfloat16", "bfloat16"]:
|
| 49 |
-
return Precision.bfloat16
|
| 50 |
-
if precision in ["torch.bfloat32", "bfloat32"]:
|
| 51 |
-
return Precision.bfloat32
|
| 52 |
-
if precision in ["torch.float32", "float32"]:
|
| 53 |
-
return Precision.float32
|
| 54 |
|
| 55 |
class ModelType(Enum):
|
| 56 |
PT = ModelDetails(name="pretrained", symbol="🟢")
|
|
@@ -83,26 +67,21 @@ def start_compute_space():
|
|
| 83 |
return f"Okay! {COMPUTE_SPACE} should be running now!"
|
| 84 |
|
| 85 |
|
| 86 |
-
def get_model_size(model_info: ModelInfo
|
| 87 |
"""Gets the model size from the configuration, or the model name if the configuration does not contain the information."""
|
| 88 |
try:
|
| 89 |
model_size = round(model_info.safetensors["total"] / 1e9, 3)
|
| 90 |
except (AttributeError, TypeError):
|
| 91 |
return 0 # Unknown model sizes are indicated as 0, see NUMERIC_INTERVALS in app.py
|
| 92 |
-
|
| 93 |
-
size_factor = 8 if (precision == "GPTQ" or "gptq" in model_info.modelId.lower()) else 1
|
| 94 |
-
model_size = size_factor * model_size
|
| 95 |
return model_size
|
| 96 |
|
| 97 |
|
| 98 |
def add_new_eval(
|
| 99 |
repo_id: str,
|
| 100 |
-
precision: str,
|
| 101 |
task: str,
|
| 102 |
):
|
| 103 |
model_owner = repo_id.split("/")[0]
|
| 104 |
-
model_name = repo_id.split("/")[1]
|
| 105 |
-
precision = precision.split(" ")[0]
|
| 106 |
|
| 107 |
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 108 |
|
|
@@ -114,7 +93,7 @@ def add_new_eval(
|
|
| 114 |
return
|
| 115 |
# return styled_error("Could not get your model information. Please fill it up properly.")
|
| 116 |
|
| 117 |
-
model_size = get_model_size(model_info=model_info
|
| 118 |
|
| 119 |
print("Adding request")
|
| 120 |
|
|
@@ -122,7 +101,7 @@ def add_new_eval(
|
|
| 122 |
|
| 123 |
request_dict = {
|
| 124 |
"model": repo_id,
|
| 125 |
-
"precision":
|
| 126 |
"status": "PENDING",
|
| 127 |
"submitted_time": pd.to_datetime(current_time),
|
| 128 |
"task": task,
|
|
@@ -158,18 +137,12 @@ with gr.Blocks() as demo:
|
|
| 158 |
task = gr.Dropdown(
|
| 159 |
choices=tasks,
|
| 160 |
label="Choose a benchmark task",
|
|
|
|
| 161 |
multiselect=False,
|
| 162 |
interactive=True,
|
| 163 |
)
|
| 164 |
with gr.Column():
|
| 165 |
model_name_textbox = gr.Textbox(label="Model name")
|
| 166 |
-
precision = gr.Dropdown(
|
| 167 |
-
choices=[i.value.name for i in Precision if i != Precision.Unknown],
|
| 168 |
-
label="Precision",
|
| 169 |
-
multiselect=False,
|
| 170 |
-
value="float16",
|
| 171 |
-
interactive=True,
|
| 172 |
-
)
|
| 173 |
|
| 174 |
with gr.Row():
|
| 175 |
with gr.Column():
|
|
@@ -179,7 +152,6 @@ with gr.Blocks() as demo:
|
|
| 179 |
fn=add_new_eval,
|
| 180 |
inputs=[
|
| 181 |
model_name_textbox,
|
| 182 |
-
precision,
|
| 183 |
task,
|
| 184 |
],
|
| 185 |
outputs=submission_result,
|
|
|
|
| 35 |
Original = ModelDetails("Original")
|
| 36 |
Delta = ModelDetails("Delta")
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
class ModelType(Enum):
|
| 40 |
PT = ModelDetails(name="pretrained", symbol="🟢")
|
|
|
|
| 67 |
return f"Okay! {COMPUTE_SPACE} should be running now!"
|
| 68 |
|
| 69 |
|
| 70 |
+
def get_model_size(model_info: ModelInfo):
|
| 71 |
"""Gets the model size from the configuration, or the model name if the configuration does not contain the information."""
|
| 72 |
try:
|
| 73 |
model_size = round(model_info.safetensors["total"] / 1e9, 3)
|
| 74 |
except (AttributeError, TypeError):
|
| 75 |
return 0 # Unknown model sizes are indicated as 0, see NUMERIC_INTERVALS in app.py
|
|
|
|
|
|
|
|
|
|
| 76 |
return model_size
|
| 77 |
|
| 78 |
|
| 79 |
def add_new_eval(
|
| 80 |
repo_id: str,
|
|
|
|
| 81 |
task: str,
|
| 82 |
):
|
| 83 |
model_owner = repo_id.split("/")[0]
|
| 84 |
+
model_name = repo_id.split("/")[1]
|
|
|
|
| 85 |
|
| 86 |
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 87 |
|
|
|
|
| 93 |
return
|
| 94 |
# return styled_error("Could not get your model information. Please fill it up properly.")
|
| 95 |
|
| 96 |
+
model_size = get_model_size(model_info=model_info)
|
| 97 |
|
| 98 |
print("Adding request")
|
| 99 |
|
|
|
|
| 101 |
|
| 102 |
request_dict = {
|
| 103 |
"model": repo_id,
|
| 104 |
+
"precision": "N/A",
|
| 105 |
"status": "PENDING",
|
| 106 |
"submitted_time": pd.to_datetime(current_time),
|
| 107 |
"task": task,
|
|
|
|
| 137 |
task = gr.Dropdown(
|
| 138 |
choices=tasks,
|
| 139 |
label="Choose a benchmark task",
|
| 140 |
+
value = 'Text Generation',
|
| 141 |
multiselect=False,
|
| 142 |
interactive=True,
|
| 143 |
)
|
| 144 |
with gr.Column():
|
| 145 |
model_name_textbox = gr.Textbox(label="Model name")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
with gr.Row():
|
| 148 |
with gr.Column():
|
|
|
|
| 152 |
fn=add_new_eval,
|
| 153 |
inputs=[
|
| 154 |
model_name_textbox,
|
|
|
|
| 155 |
task,
|
| 156 |
],
|
| 157 |
outputs=submission_result,
|