Skip to content

Commit 8aaf683

Browse files
[TorchFX] Constant folding is removed from nncf.quantize and OpenVINOQuantizer
1 parent a9427df commit 8aaf683

File tree

11 files changed

+36848
-28756
lines changed

11 files changed

+36848
-28756
lines changed

nncf/experimental/torch/fx/quantization/quantize_model.py

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def quantize_impl(
8787
advanced_parameters=advanced_parameters,
8888
)
8989

90-
# To make it easier for bias correction algorithms.
9190
apply_quantization_transformations(copied_model)
9291

9392
nncf_graph = NNCFGraphFactory.create(copied_model)

nncf/experimental/torch/fx/quantization/quantizer/openvino_quantizer.py

-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from nncf.common.utils.api_marker import api
3939
from nncf.experimental.torch.fx.nncf_graph_builder import GraphConverter
4040
from nncf.experimental.torch.fx.node_utils import get_graph_node_by_name
41-
from nncf.experimental.torch.fx.transformations import fold_constant_except_qdq
4241
from nncf.quantization.advanced_parameters import FP8QuantizationParameters
4342
from nncf.quantization.advanced_parameters import QuantizationParameters
4443
from nncf.quantization.algorithms.min_max.algorithm import MinMaxQuantization
@@ -361,5 +360,4 @@ def transform_for_annotation(self, model: torch.fx.GraphModule) -> torch.fx.Grap
361360
:param model: Given torch.fx.GraphModule to transform before the annotation.
362361
:return: The transformed torch.fx.GraphModule ready for the annotation.
363362
"""
364-
fold_constant_except_qdq(model)
365363
return model

nncf/experimental/torch/fx/transformations.py

-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@ def apply_quantization_transformations(model: torch.fx.GraphModule) -> None:
733733
# to make it easier for algorithms to work
734734
# with the target graph BatchNorm operations
735735
# are being fused
736-
fold_constant_except_qdq(model)
737736
_fuse_conv_bn_(model)
738737

739738

tests/torch/data/reference_graphs/fx/experimental/OpenVINOQuantizer/swin_v2_s.dot

+7,308-5,262
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/experimental/OpenVINOQuantizer/vit_b_16.dot

+2,011-2,009
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/experimental/ao_export_quantization_OpenVINOQuantizer/swin_v2_s.dot

+6,800-4,850
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/experimental/ao_export_quantization_OpenVINOQuantizer/vit_b_16.dot

+1,789-1,787
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/post_quantization_compressed/swin_v2_s.dot

+7,308-5,262
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/post_quantization_compressed/vit_b_16.dot

+2,011-2,009
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/quantized/swin_v2_s.dot

+7,510-5,464
Large diffs are not rendered by default.

tests/torch/data/reference_graphs/fx/quantized/vit_b_16.dot

+2,111-2,109
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)