@@ -256,10 +256,8 @@ class AdvancedQuantizationParameters:
256
256
:type smooth_quant_alpha: float
257
257
:param backend_params: Backend-specific parameters.
258
258
: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
263
261
"""
264
262
265
263
# General parameters
@@ -274,6 +272,7 @@ class AdvancedQuantizationParameters:
274
272
activations_quantization_params : Optional [Union [QuantizationParameters , FP8QuantizationParameters ]] = None
275
273
weights_quantization_params : Optional [Union [QuantizationParameters , FP8QuantizationParameters ]] = None
276
274
quantizer_propagation_rule : QuantizerPropagationRule = QuantizerPropagationRule .MERGE_ALL_IN_ONE
275
+ compress_weights : bool = True
277
276
278
277
# Range estimator parameters
279
278
activations_range_estimator_params : RangeEstimatorParameters = field (default_factory = RangeEstimatorParameters )
@@ -290,9 +289,6 @@ class AdvancedQuantizationParameters:
290
289
# Backend specific parameters
291
290
backend_params : dict [str , Any ] = field (default_factory = dict )
292
291
293
- # Backend parameter names
294
- COMPRESS_WEIGHTS = "compress_weights"
295
-
296
292
297
293
def is_weight_compression_needed (advanced_parameters : Optional [AdvancedQuantizationParameters ]) -> bool :
298
294
"""
@@ -304,7 +300,7 @@ def is_weight_compression_needed(advanced_parameters: Optional[AdvancedQuantizat
304
300
:return: True if weight compression is needed, False otherwise.
305
301
"""
306
302
if advanced_parameters .backend_params is not None :
307
- return bool ( advanced_parameters .backend_params . get ( AdvancedQuantizationParameters . COMPRESS_WEIGHTS , True ))
303
+ return advanced_parameters .compress_weights
308
304
return True
309
305
310
306
0 commit comments