@@ -190,6 +190,24 @@ def parse_args_openvino(parser: "ArgumentParser"):
190
190
)
191
191
192
192
193
+ def no_compression_parameter_provided (args ):
194
+ return all (
195
+ map (
196
+ lambda x : x is None ,
197
+ (
198
+ args .ratio ,
199
+ args .group_size ,
200
+ args .sym ,
201
+ args .all_layers ,
202
+ args .dataset ,
203
+ args .num_samples ,
204
+ args .awq ,
205
+ args .sensitivity_metric ,
206
+ ),
207
+ )
208
+ )
209
+
210
+
193
211
class OVExportCommand (BaseOptimumCLICommand ):
194
212
COMMAND = CommandInfo (name = "openvino" , help = "Export PyTorch models to OpenVINO IR." )
195
213
@@ -230,23 +248,17 @@ def run(self):
230
248
231
249
if self .args .weight_format is None :
232
250
ov_config = None
251
+ if not no_compression_parameter_provided (self .args ):
252
+ logger .warning (
253
+ "The provided compression parameters will not affect conversion because of the missing --weight-format argument."
254
+ )
233
255
elif self .args .weight_format in {"fp16" , "fp32" }:
234
256
ov_config = OVConfig (dtype = self .args .weight_format )
235
257
else :
236
258
is_int8 = self .args .weight_format == "int8"
237
259
238
- # For int4 quantization if not parameter is provided, then use the default config if exist
239
- if (
240
- not is_int8
241
- and self .args .ratio is None
242
- and self .args .group_size is None
243
- and self .args .sym is None
244
- and self .args .all_layers is None
245
- and self .args .dataset is None
246
- and self .args .num_samples is None
247
- and self .args .awq is None
248
- and self .args .sensitivity_metric is None
249
- ):
260
+ # For int4 quantization if no parameter is provided, then use the default config if exist
261
+ if no_compression_parameter_provided (self .args ) and not is_int8 :
250
262
quantization_config = get_default_int4_config (self .args .model )
251
263
else :
252
264
quantization_config = {
0 commit comments