Skip to content

Commit 5b61845

Browse files
committed
Make compress_weights boolean parameter in AdvancedQuantizationParameters
1 parent 7416dce commit 5b61845

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/nncf/quantization/advanced_parameters.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,8 @@ class AdvancedQuantizationParameters:
256256
:type smooth_quant_alpha: float
257257
:param backend_params: Backend-specific parameters.
258258
:type backend_params: dict[str, Any]
259-
:param COMPRESS_WEIGHTS: A key in the `backend_params` dictionary that indicates whether
260-
weight compression should be applied. If set to False, weight compression is disabled.
261-
By default, weight compression is enabled (True).
262-
:type COMPRESS_WEIGHTS: str
259+
:param compress_weights: Indicates whether to apply weight compression after quantization.
260+
:type compress_weights: bool
263261
"""
264262

265263
# General parameters
@@ -290,8 +288,8 @@ class AdvancedQuantizationParameters:
290288
# Backend specific parameters
291289
backend_params: dict[str, Any] = field(default_factory=dict)
292290

293-
# Backend parameter names
294-
COMPRESS_WEIGHTS = "compress_weights"
291+
# Weight compression control
292+
compress_weights = True
295293

296294

297295
def is_weight_compression_needed(advanced_parameters: Optional[AdvancedQuantizationParameters]) -> bool:
@@ -304,7 +302,7 @@ def is_weight_compression_needed(advanced_parameters: Optional[AdvancedQuantizat
304302
:return: True if weight compression is needed, False otherwise.
305303
"""
306304
if advanced_parameters.backend_params is not None:
307-
return bool(advanced_parameters.backend_params.get(AdvancedQuantizationParameters.COMPRESS_WEIGHTS, True))
305+
return advanced_parameters.compress_weights
308306
return True
309307

310308

0 commit comments

Comments
 (0)