From 7134fcb442b63848410cf67549cbb3f53ede4289 Mon Sep 17 00:00:00 2001 From: dlyakhov Date: Mon, 20 Jan 2025 18:09:55 +0100 Subject: [PATCH] Embedding qconfig list is extended for CPU devices / tests fixes --- nncf/common/hardware/configs/cpu.json | 2 +- tests/cross_fw/test_templates/test_quantizer_config.py | 8 ++++---- .../reference_scales/embedding_model_performance.json | 4 ++-- tests/onnx/quantization/test_qdq_params_calculation.py | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/nncf/common/hardware/configs/cpu.json b/nncf/common/hardware/configs/cpu.json index d7313c26f14..649ade47c77 100644 --- a/nncf/common/hardware/configs/cpu.json +++ b/nncf/common/hardware/configs/cpu.json @@ -293,7 +293,7 @@ { "type": "Embedding", "quantization": { - "weights": ["q8_w_sym", "q8_w_asym"] + "weights": ["q8_w_sym", "q8_w_asym", "q8_a", "q8_a_sym", "q8_a_ch"] } }, {"type": "EmbeddingBag"} diff --git a/tests/cross_fw/test_templates/test_quantizer_config.py b/tests/cross_fw/test_templates/test_quantizer_config.py index ec3f856845c..5d5c3699385 100644 --- a/tests/cross_fw/test_templates/test_quantizer_config.py +++ b/tests/cross_fw/test_templates/test_quantizer_config.py @@ -158,10 +158,10 @@ def test_default_quantizer_config(self, single_conv_nncf_graph): ) weight_default_config = QuantizerConfig( - mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=True, per_channel=True + mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=True, per_channel=True, narrow_range=True ) activation_default_config = QuantizerConfig( - mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=None, per_channel=False + mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=None, per_channel=False, narrow_range=False ) assert len(q_setup.quantization_points) == 2 @@ -244,10 +244,10 @@ def test_depthwise_conv_default_quantizer_config(self, depthwise_conv_nncf_graph ) weight_default_config = QuantizerConfig( - mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=True, per_channel=True + mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=True, per_channel=True, narrow_range=True ) activation_default_config = QuantizerConfig( - mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=None, per_channel=True + mode=QuantizationMode.SYMMETRIC, num_bits=8, signedness_to_force=None, per_channel=True, narrow_range=False ) assert len(q_setup.quantization_points) == 2 diff --git a/tests/onnx/data/reference_scales/embedding_model_performance.json b/tests/onnx/data/reference_scales/embedding_model_performance.json index d8b07fb14c6..f6b304ace82 100644 --- a/tests/onnx/data/reference_scales/embedding_model_performance.json +++ b/tests/onnx/data/reference_scales/embedding_model_performance.json @@ -1,7 +1,7 @@ { "QuantizeLinear_Identity_Y_1": { - "scale": 0.007852046750485897, - "zero_point": 0 + "scale": 0.007821254432201385, + "zero_point": -1 }, "QuantizeLinear_W_1": { "scale": [ diff --git a/tests/onnx/quantization/test_qdq_params_calculation.py b/tests/onnx/quantization/test_qdq_params_calculation.py index 7d084a92a8c..95ffa3cff1f 100644 --- a/tests/onnx/quantization/test_qdq_params_calculation.py +++ b/tests/onnx/quantization/test_qdq_params_calculation.py @@ -109,8 +109,7 @@ def test_scales(model, preset): ref_stats_path = REFERENCE_SCALES_DIR / ref_stats_name # Unkomment lines below to generate reference for new models. - # from tests.shared.helpers import dump_to_json - + # from tests.cross_fw.shared.json import dump_to_json # dump_to_json(ref_stats_path, q_nodes_params) ref_nodes_params = load_json(ref_stats_path)