Skip to content

Commit 8be0df1

Browse files
Polishing changes
1 parent e3412a6 commit 8be0df1

10 files changed

+207
-273
lines changed

optimum/commands/export/openvino.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -342,33 +342,33 @@ def run(self):
342342
if no_compression_parameter_provided(self.args) and self.args.weight_format == "int4":
343343
quantization_config = get_default_int4_config(self.args.model)
344344
else:
345-
quantization_config = prepare_for_wc_config(self.args, _DEFAULT_4BIT_CONFIG)
345+
quantization_config = prepare_wc_config(self.args, _DEFAULT_4BIT_CONFIG)
346346

347347
if quantization_config.get("dataset", None) is not None:
348348
quantization_config["trust_remote_code"] = self.args.trust_remote_code
349349
ov_config = OVConfig(quantization_config=quantization_config)
350-
elif self.args.quant_mode is not None:
350+
else:
351351
if self.args.dataset is None:
352352
raise ValueError(
353353
"Dataset is required for full quantization. Please provide it with --dataset argument."
354354
)
355355

356356
if self.args.quant_mode == "nf4_f8e4m3":
357-
wc_config = prepare_for_wc_config(self.args, _DEFAULT_4BIT_CONFIG)
357+
wc_config = prepare_wc_config(self.args, _DEFAULT_4BIT_CONFIG)
358358
wc_config["weight_format"] = "nf4"
359359

360-
q_config = prepare_for_q_config(self.args)
360+
q_config = prepare_q_config(self.args)
361361
q_config["activation_format"] = "f8e4m3"
362362

363363
quantization_config = dict(
364364
weight_quantization_config=wc_config,
365-
quantization_config=q_config,
365+
activation_quantization_config=q_config,
366366
num_samples=self.args.num_samples,
367367
dataset=self.args.dataset,
368368
trust_remote_code=self.args.trust_remote_code,
369369
)
370370
else:
371-
quantization_config = prepare_for_q_config(self.args)
371+
quantization_config = prepare_q_config(self.args)
372372
ov_config = OVConfig(quantization_config=quantization_config)
373373

374374
quantization_config = ov_config.quantization_config if ov_config else None
@@ -462,7 +462,7 @@ def run(self):
462462
)
463463

464464

465-
def prepare_for_wc_config(args, default_configs):
465+
def prepare_wc_config(args, default_configs):
466466
is_int8 = args.weight_format == "int8"
467467
return {
468468
"bits": 8 if is_int8 else 4,
@@ -482,9 +482,8 @@ def prepare_for_wc_config(args, default_configs):
482482
}
483483

484484

485-
def prepare_for_q_config(args):
485+
def prepare_q_config(args):
486486
return {
487-
"weight_format": args.quant_mode,
488487
"activation_format": args.quant_mode,
489488
"bits": 8,
490489
"sym": args.sym or False,

0 commit comments

Comments
 (0)