Spaces:
Running
Running
fix suffix
Browse files
app.py
CHANGED
@@ -59,6 +59,7 @@ def quantize_model(
|
|
59 |
return f"### Invalid input π Please specify a model name, got {model_id}"
|
60 |
|
61 |
try:
|
|
|
62 |
model_name = model_id.split("/")[-1]
|
63 |
username = whoami(oauth_token.token)["name"]
|
64 |
suffix = f"{dtype}" if model_name.endswith("openvino") else f"openvino-{dtype}"
|
@@ -94,7 +95,7 @@ def quantize_model(
|
|
94 |
if calibration_dataset == "None":
|
95 |
calibration_dataset = None
|
96 |
|
97 |
-
is_int8 = dtype == "
|
98 |
# if library_name == "diffusers":
|
99 |
# quant_method = "hybrid"
|
100 |
if not is_int8 and calibration_dataset is not None:
|
@@ -109,7 +110,7 @@ def quantize_model(
|
|
109 |
quant_method=quant_method,
|
110 |
dataset=None if quant_method=="default" else calibration_dataset,
|
111 |
ratio=1.0 if is_int8 else ratio,
|
112 |
-
num_samples=None if quant_method=="default" else
|
113 |
)
|
114 |
|
115 |
api = HfApi(token=oauth_token.token)
|
|
|
59 |
return f"### Invalid input π Please specify a model name, got {model_id}"
|
60 |
|
61 |
try:
|
62 |
+
dtype = dtype.replace("-", "")
|
63 |
model_name = model_id.split("/")[-1]
|
64 |
username = whoami(oauth_token.token)["name"]
|
65 |
suffix = f"{dtype}" if model_name.endswith("openvino") else f"openvino-{dtype}"
|
|
|
95 |
if calibration_dataset == "None":
|
96 |
calibration_dataset = None
|
97 |
|
98 |
+
is_int8 = dtype == "8bit"
|
99 |
# if library_name == "diffusers":
|
100 |
# quant_method = "hybrid"
|
101 |
if not is_int8 and calibration_dataset is not None:
|
|
|
110 |
quant_method=quant_method,
|
111 |
dataset=None if quant_method=="default" else calibration_dataset,
|
112 |
ratio=1.0 if is_int8 else ratio,
|
113 |
+
num_samples=None if quant_method=="default" else 20,
|
114 |
)
|
115 |
|
116 |
api = HfApi(token=oauth_token.token)
|