From 7e3bda829e385c5334d3d3cde6c99a65b3117d5a Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Thu, 30 Oct 2025 10:18:49 +0000 Subject: [PATCH 1/9] update --- tests/post_training/pipelines/image_classification_timm.py | 1 - .../post_training/pipelines/image_classification_torchvision.py | 1 - tests/post_training/requirements.txt | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/post_training/pipelines/image_classification_timm.py b/tests/post_training/pipelines/image_classification_timm.py index 8f2d53b8fb1..9331ee99af0 100644 --- a/tests/post_training/pipelines/image_classification_timm.py +++ b/tests/post_training/pipelines/image_classification_timm.py @@ -53,7 +53,6 @@ def prepare_model(self) -> None: onnx_path, export_params=True, opset_version=13, - dynamo=False, **additional_kwargs, ) self.model = onnx.load(onnx_path) diff --git a/tests/post_training/pipelines/image_classification_torchvision.py b/tests/post_training/pipelines/image_classification_torchvision.py index 781dfc6f3ad..217e8492b93 100644 --- a/tests/post_training/pipelines/image_classification_torchvision.py +++ b/tests/post_training/pipelines/image_classification_torchvision.py @@ -100,7 +100,6 @@ def prepare_model(self) -> None: onnx_path, export_params=True, opset_version=13, - dynamo=False, **additional_kwargs, ) self.model = onnx.load(onnx_path) diff --git a/tests/post_training/requirements.txt b/tests/post_training/requirements.txt index 0a9609ed390..d64027e6554 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -22,3 +22,4 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.3.0.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 +onnxscript==0.5.4 From bcb8bf5b4f42814925d4ea2a4c802e5c9e18af65 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Wed, 5 Nov 2025 07:33:53 +0000 Subject: [PATCH 2/9] test --- .../pipelines/image_classification_timm.py | 12 +++++++++--- tests/post_training/requirements.txt | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/post_training/pipelines/image_classification_timm.py b/tests/post_training/pipelines/image_classification_timm.py index 9331ee99af0..57834a78801 100644 --- a/tests/post_training/pipelines/image_classification_timm.py +++ b/tests/post_training/pipelines/image_classification_timm.py @@ -11,6 +11,7 @@ import numpy as np import onnx +import onnxoptimizer import openvino as ov import timm import torch @@ -45,17 +46,22 @@ def prepare_model(self) -> None: onnx_path = self.fp32_model_dir / "model_fp32.onnx" additional_kwargs = {} if self.batch_size > 1: - additional_kwargs["input_names"] = ["image"] - additional_kwargs["dynamic_axes"] = {"image": {0: "batch"}} + batch = torch.export.Dim("batch") + additional_kwargs["dynamic_shapes"] = ({0: batch},) + torch.onnx.export( timm_model, self.dummy_tensor, onnx_path, export_params=True, opset_version=13, + dynamo=True, **additional_kwargs, ) - self.model = onnx.load(onnx_path) + + model = onnx.load(onnx_path) + passes = ["fuse_bn_into_conv"] + self.model = onnxoptimizer.optimize(model, passes) self.input_name = self.model.graph.input[0].name if self.backend in OV_BACKENDS + [BackendType.FP32]: diff --git a/tests/post_training/requirements.txt b/tests/post_training/requirements.txt index d64027e6554..2c53a5eeb72 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -23,3 +23,4 @@ transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.3.0.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 onnxscript==0.5.4 +onnxoptimizer==0.3.8 From e3e9062ec95687e659c8daf79aa2b3787e6799a8 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Wed, 5 Nov 2025 08:15:27 +0000 Subject: [PATCH 3/9] update --- tests/post_training/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/post_training/requirements.txt b/tests/post_training/requirements.txt index 2c53a5eeb72..63f9617aa47 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -22,5 +22,5 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.3.0.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 -onnxscript==0.5.4 +onnxscript onnxoptimizer==0.3.8 From cd5f3cca29051c0face90f93a9a84097c98661b8 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Mon, 10 Nov 2025 13:19:57 +0000 Subject: [PATCH 4/9] Fix --- src/nncf/onnx/graph/metatypes/groups.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nncf/onnx/graph/metatypes/groups.py b/src/nncf/onnx/graph/metatypes/groups.py index 758b61eee08..514b5ac3040 100644 --- a/src/nncf/onnx/graph/metatypes/groups.py +++ b/src/nncf/onnx/graph/metatypes/groups.py @@ -54,6 +54,7 @@ onnx_metatypes.ONNXDepthwiseConvolutionMetatype, onnx_metatypes.ONNXConvolutionTransposeMetatype, onnx_metatypes.ONNXDeformableConvolutionMetatype, + onnx_metatypes.ONNXGroupConvolutionMetatype, ] LINEAR_OPERATIONS = [*CONVOLUTION_METATYPES, *MATMUL_METATYPES] From bba1a95ff6f88a199aa6cef83b194c00a83aafd7 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Mon, 10 Nov 2025 13:21:56 +0000 Subject: [PATCH 5/9] revert --- tests/post_training/pipelines/image_classification_timm.py | 5 +---- tests/post_training/requirements.txt | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/post_training/pipelines/image_classification_timm.py b/tests/post_training/pipelines/image_classification_timm.py index 57834a78801..67f03121151 100644 --- a/tests/post_training/pipelines/image_classification_timm.py +++ b/tests/post_training/pipelines/image_classification_timm.py @@ -11,7 +11,6 @@ import numpy as np import onnx -import onnxoptimizer import openvino as ov import timm import torch @@ -59,9 +58,7 @@ def prepare_model(self) -> None: **additional_kwargs, ) - model = onnx.load(onnx_path) - passes = ["fuse_bn_into_conv"] - self.model = onnxoptimizer.optimize(model, passes) + self.model = onnx.load(onnx_path) self.input_name = self.model.graph.input[0].name if self.backend in OV_BACKENDS + [BackendType.FP32]: diff --git a/tests/post_training/requirements.txt b/tests/post_training/requirements.txt index 63f9617aa47..2847e8490df 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -23,4 +23,3 @@ transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.3.0.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 onnxscript -onnxoptimizer==0.3.8 From 26e8eddd0233b8d3bf6738e2fabbbb54848c6d1e Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Mon, 10 Nov 2025 13:23:30 +0000 Subject: [PATCH 6/9] minor --- tests/post_training/pipelines/image_classification_timm.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/post_training/pipelines/image_classification_timm.py b/tests/post_training/pipelines/image_classification_timm.py index 67f03121151..20970c02f36 100644 --- a/tests/post_training/pipelines/image_classification_timm.py +++ b/tests/post_training/pipelines/image_classification_timm.py @@ -54,7 +54,6 @@ def prepare_model(self) -> None: onnx_path, export_params=True, opset_version=13, - dynamo=True, **additional_kwargs, ) From 737f446fde1354a59999caa090eeec36cd006fcf Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Tue, 11 Nov 2025 10:55:53 +0000 Subject: [PATCH 7/9] minor --- tests/post_training/pipelines/image_classification_timm.py | 6 ++---- tests/post_training/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/post_training/pipelines/image_classification_timm.py b/tests/post_training/pipelines/image_classification_timm.py index 20970c02f36..9331ee99af0 100644 --- a/tests/post_training/pipelines/image_classification_timm.py +++ b/tests/post_training/pipelines/image_classification_timm.py @@ -45,9 +45,8 @@ def prepare_model(self) -> None: onnx_path = self.fp32_model_dir / "model_fp32.onnx" additional_kwargs = {} if self.batch_size > 1: - batch = torch.export.Dim("batch") - additional_kwargs["dynamic_shapes"] = ({0: batch},) - + additional_kwargs["input_names"] = ["image"] + additional_kwargs["dynamic_axes"] = {"image": {0: "batch"}} torch.onnx.export( timm_model, self.dummy_tensor, @@ -56,7 +55,6 @@ def prepare_model(self) -> None: opset_version=13, **additional_kwargs, ) - self.model = onnx.load(onnx_path) self.input_name = self.model.graph.input[0].name diff --git a/tests/post_training/requirements.txt b/tests/post_training/requirements.txt index 2847e8490df..d64027e6554 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -22,4 +22,4 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.3.0.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 -onnxscript +onnxscript==0.5.4 From dfb446f3ad9ccb41c8ff5015efe7e9cbb01dbbe4 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Tue, 11 Nov 2025 11:37:08 +0000 Subject: [PATCH 8/9] minor --- tests/post_training/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/post_training/requirements.txt b/tests/post_training/requirements.txt index d64027e6554..1227a4df7ff 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -3,6 +3,7 @@ torch torchvision onnx onnxruntime +onnxscript openvino pytest pytest-forked @@ -22,4 +23,3 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.3.0.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 -onnxscript==0.5.4 From 2a7820a8d6a2730b574b9bf66b56a728c6e01bd6 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Wed, 12 Nov 2025 10:48:59 +0000 Subject: [PATCH 9/9] update opset version --- tests/post_training/pipelines/image_classification_timm.py | 2 +- .../post_training/pipelines/image_classification_torchvision.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/post_training/pipelines/image_classification_timm.py b/tests/post_training/pipelines/image_classification_timm.py index 9331ee99af0..8ba17f7b49a 100644 --- a/tests/post_training/pipelines/image_classification_timm.py +++ b/tests/post_training/pipelines/image_classification_timm.py @@ -52,7 +52,7 @@ def prepare_model(self) -> None: self.dummy_tensor, onnx_path, export_params=True, - opset_version=13, + opset_version=18, **additional_kwargs, ) self.model = onnx.load(onnx_path) diff --git a/tests/post_training/pipelines/image_classification_torchvision.py b/tests/post_training/pipelines/image_classification_torchvision.py index 217e8492b93..8a575c2dc1c 100644 --- a/tests/post_training/pipelines/image_classification_torchvision.py +++ b/tests/post_training/pipelines/image_classification_torchvision.py @@ -99,7 +99,7 @@ def prepare_model(self) -> None: self.dummy_tensor, onnx_path, export_params=True, - opset_version=13, + opset_version=18, **additional_kwargs, ) self.model = onnx.load(onnx_path)