File tree Expand file tree Collapse file tree 3 files changed +3
-19
lines changed
src/nncf/onnx/quantization Expand file tree Collapse file tree 3 files changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -24,23 +24,9 @@ class BackendParameters:
2424 is skipped.
2525 """
2626
27- COMPRESS_WEIGHTS = "compress_weights"
2827 EXTERNAL_DATA_DIR = "external_data_dir"
2928
3029
31- def is_weight_compression_needed (advanced_parameters : Optional [AdvancedQuantizationParameters ]) -> bool :
32- """
33- Determines whether weight compression is needed based on the provided
34- advanced quantization parameters.
35-
36- :param advanced_parameters: Advanced quantization parameters.
37- :return: `True` if weight compression is needed, `False` otherwise.
38- """
39- if advanced_parameters is not None and advanced_parameters .backend_params is not None :
40- return advanced_parameters .backend_params .get (BackendParameters .COMPRESS_WEIGHTS , True )
41- return True
42-
43-
4430def get_external_data_dir (
4531 advanced_parameters : Optional [Union [AdvancedQuantizationParameters , AdvancedCompressionParameters ]],
4632) -> Optional [str ]:
Original file line number Diff line number Diff line change 3232from nncf .onnx .graph .nncf_graph_builder import GraphConverter
3333from nncf .onnx .graph .passes import apply_preprocess_passes
3434from nncf .onnx .graph .passes import compress_quantize_weights_transformation
35- from nncf .onnx .quantization .backend_parameters import BackendParameters
3635from nncf .onnx .quantization .backend_parameters import get_external_data_dir
37- from nncf .onnx .quantization .backend_parameters import is_weight_compression_needed
3836from nncf .parameters import BackupMode
3937from nncf .parameters import CompressionFormat
4038from nncf .parameters import CompressWeightsMode
4745from nncf .quantization .advanced_parameters import AdvancedCompressionParameters
4846from nncf .quantization .advanced_parameters import AdvancedQuantizationParameters
4947from nncf .quantization .advanced_parameters import QuantizationParameters
48+ from nncf .quantization .advanced_parameters import is_weight_compression_needed
5049from nncf .quantization .algorithms .accuracy_control .algorithm import QuantizationAccuracyRestorer
5150from nncf .quantization .algorithms .accuracy_control .algorithm import calculate_accuracy_drop
5251from nncf .quantization .algorithms .accuracy_control .evaluator import Evaluator
@@ -215,7 +214,7 @@ def quantize_with_accuracy_control_impl(
215214 copied_parameters = AdvancedQuantizationParameters ()
216215 else :
217216 copied_parameters = deepcopy (advanced_quantization_parameters )
218- copied_parameters .backend_params [ BackendParameters . COMPRESS_WEIGHTS ] = False
217+ copied_parameters .compress_weights = False
219218
220219 quantized_model = quantize_impl (
221220 model = model ,
Original file line number Diff line number Diff line change 1414import nncf
1515from nncf .onnx .graph .passes import apply_preprocess_passes
1616from nncf .onnx .graph .passes import compress_quantize_weights_transformation
17- from nncf .onnx .quantization .backend_parameters import BackendParameters
1817from tests .onnx .common import ModelBuilder
1918from tests .onnx .models import build_matmul_model_with_nop_cast
2019
@@ -60,7 +59,7 @@ def test_compress_quantize_weights_transformation():
6059 model ,
6160 calibration_dataset ,
6261 advanced_parameters = nncf .AdvancedQuantizationParameters (
63- backend_params = { BackendParameters . COMPRESS_WEIGHTS : False }
62+ compress_weights = False ,
6463 ),
6564 )
6665
You can’t perform that action at this time.
0 commit comments