echarlaix HF staff commited on
Commit
d4c3e31
·
1 Parent(s): 3dd4499

add calibration num samples

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -91,10 +91,13 @@ def quantize_model(
91
  )
92
  export = len(ov_files) == 0
93
 
 
 
 
94
  is_int8 = dtype == "int8"
95
  if library_name == "diffusers":
96
  quant_method = "hybrid"
97
- elif not is_int8:
98
  quant_method = "awq"
99
  else:
100
  quant_method = "default"
@@ -104,6 +107,7 @@ def quantize_model(
104
  quant_method=quant_method,
105
  dataset=None if quant_method=="default" else calibration_dataset,
106
  ratio=1.0 if is_int8 else ratio,
 
107
  )
108
 
109
  api = HfApi(token=oauth_token.token)
 
91
  )
92
  export = len(ov_files) == 0
93
 
94
+ if calibration_dataset == "None":
95
+ calibration_dataset = None
96
+
97
  is_int8 = dtype == "int8"
98
  if library_name == "diffusers":
99
  quant_method = "hybrid"
100
+ elif not is_int8 and calibration_dataset is not None:
101
  quant_method = "awq"
102
  else:
103
  quant_method = "default"
 
107
  quant_method=quant_method,
108
  dataset=None if quant_method=="default" else calibration_dataset,
109
  ratio=1.0 if is_int8 else ratio,
110
+ num_samples=50,
111
  )
112
 
113
  api = HfApi(token=oauth_token.token)