Skip to content

Commit 25aa43d

Browse files
Add statistics_path to OVWeightQuantizationConfig
1 parent c8c6beb commit 25aa43d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

optimum/intel/openvino/configuration.py

+9
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ class OVWeightQuantizationConfig(OVQuantizationConfigBase):
427427
retained in their original precision without any quantization.
428428
- "int8_sym" stands for 8-bit integer symmetric quantization without zero point.
429429
- "int8_asym" stands for 8-bit integer asymmetric quantization with zero points per each quantization group.
430+
statistics_path (`str`, *optional*):
431+
The directory to save/load NNCF data-aware statistics to/from. Such caching is useful for speeding up
432+
running many data-aware compression experiments on the same model and dataset.
430433
"""
431434

432435
def __init__(
@@ -449,6 +452,7 @@ def __init__(
449452
processor: Optional[str] = None,
450453
lora_correction: bool = None,
451454
backup_precision: Optional[str] = None,
455+
statistics_path: Optional[str] = None,
452456
**kwargs,
453457
):
454458
super().__init__(
@@ -470,6 +474,7 @@ def __init__(
470474
self.gptq = gptq
471475
self.lora_correction = lora_correction
472476
self.backup_precision = backup_precision
477+
self.statistics_path = statistics_path
473478
if kwargs.get("weight_format") is not None:
474479
logger.warning(
475480
"The `weight_format` parameter is deprecated and will be removed in optimum-intel v1.24.0. "
@@ -611,6 +616,9 @@ def to_nncf_dict(self) -> Dict[str, Any]:
611616
awq = True if self.quant_method == OVQuantizationMethod.AWQ else None
612617
sensitivity_metric = nncf.SensitivityMetric(self.sensitivity_metric) if self.sensitivity_metric else None
613618
backup_mode = nncf.BackupMode(self.backup_precision) if self.backup_precision else None
619+
advanced_parameters = None
620+
if self.statistics_path is not None:
621+
advanced_parameters = nncf.AdvancedCompressionParameters(statistics_path=self.statistics_path)
614622
result = {
615623
"mode": mode,
616624
"ratio": self.ratio,
@@ -624,6 +632,7 @@ def to_nncf_dict(self) -> Dict[str, Any]:
624632
"gptq": self.gptq,
625633
"lora_correction": self.lora_correction,
626634
"backup_mode": backup_mode,
635+
"advanced_parameters": advanced_parameters,
627636
}
628637
return result
629638

0 commit comments

Comments
 (0)