Spaces:
Running
Running
MekkCyber
commited on
Commit
·
d6df0f3
1
Parent(s):
2f8a4dc
fix
Browse files
app.py
CHANGED
|
@@ -120,6 +120,11 @@ def quantize_and_save(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToke
|
|
| 120 |
if quantization_type == "int4_weight_only" :
|
| 121 |
return "int4_weight_only not supported on cpu"
|
| 122 |
# try :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
quantized_model = quantize_model(model_name, quantization_type, group_size, oauth_token, profile.username)
|
| 124 |
return save_model(quantized_model, model_name, quantization_type, group_size, profile.username, oauth_token, quantized_model_name)
|
| 125 |
# except Exception as e :
|
|
@@ -217,7 +222,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as app:
|
|
| 217 |
|
| 218 |
quantize_button.click(
|
| 219 |
fn=quantize_and_save,
|
| 220 |
-
inputs=[model_name, quantization_type,
|
| 221 |
outputs=[output_link]
|
| 222 |
)
|
| 223 |
|
|
|
|
| 120 |
if quantization_type == "int4_weight_only" :
|
| 121 |
return "int4_weight_only not supported on cpu"
|
| 122 |
# try :
|
| 123 |
+
if not group_size.isdigit() :
|
| 124 |
+
return "group_size must be a number"
|
| 125 |
+
|
| 126 |
+
group_size = int(group_size)
|
| 127 |
+
|
| 128 |
quantized_model = quantize_model(model_name, quantization_type, group_size, oauth_token, profile.username)
|
| 129 |
return save_model(quantized_model, model_name, quantization_type, group_size, profile.username, oauth_token, quantized_model_name)
|
| 130 |
# except Exception as e :
|
|
|
|
| 222 |
|
| 223 |
quantize_button.click(
|
| 224 |
fn=quantize_and_save,
|
| 225 |
+
inputs=[model_name, quantization_type, group_size, quantized_model_name],
|
| 226 |
outputs=[output_link]
|
| 227 |
)
|
| 228 |
|