From 944cf6cb612c2133d514efb2412561ce67d314df Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Thu, 30 Oct 2025 10:18:49 +0000 Subject: [PATCH 01/10] update --- tests/post_training/pipelines/image_classification_timm.py | 1 - .../post_training/pipelines/image_classification_torchvision.py | 1 - tests/post_training/requirements.txt | 2 ++ 3 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 dee4326542d..0423a2db1d1 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 7fe8815edd4..a0f7cf412bc 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 44242158c47..d13a9a7c9e8 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -25,3 +25,5 @@ timm==0.9.2 accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark +datasets==3.6.0 +onnxscript==0.5.4 From a67812046880e754a967cfe674ba5dde453f0774 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Wed, 5 Nov 2025 07:33:53 +0000 Subject: [PATCH 02/10] 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 0423a2db1d1..10556014461 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 d13a9a7c9e8..67d400ca476 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -27,3 +27,4 @@ transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 onnxscript==0.5.4 +onnxoptimizer==0.3.8 From 530cc0a4d89f5349525839e98cf9e648fa1c1661 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Wed, 5 Nov 2025 08:15:27 +0000 Subject: [PATCH 03/10] 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 67d400ca476..8f946fef689 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -26,5 +26,5 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 -onnxscript==0.5.4 +onnxscript onnxoptimizer==0.3.8 From 695eb0b236fc1073c4fa4fa3042db38ac7f5cdf3 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Mon, 10 Nov 2025 13:19:57 +0000 Subject: [PATCH 04/10] 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 32d490b2ed2..d772624dd06 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 4c775dafb37d2e57bce77d36f7b40a212765d2b0 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Mon, 10 Nov 2025 13:21:56 +0000 Subject: [PATCH 05/10] 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 10556014461..b1ba4ddf53b 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 8f946fef689..48e50073789 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -27,4 +27,3 @@ transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 onnxscript -onnxoptimizer==0.3.8 From 4212fe44bdb58779324f0bcba6633ec8fbcc7137 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Mon, 10 Nov 2025 13:23:30 +0000 Subject: [PATCH 06/10] 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 b1ba4ddf53b..39b2989281b 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 a7c33b1a5e6fcca5225d223a45dd3cb8244ed20f Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Tue, 11 Nov 2025 10:55:53 +0000 Subject: [PATCH 07/10] 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 39b2989281b..0423a2db1d1 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 48e50073789..d13a9a7c9e8 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -26,4 +26,4 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 -onnxscript +onnxscript==0.5.4 From 90875f14f09a785812ef9eafab875c074ce1161d Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Tue, 11 Nov 2025 11:37:08 +0000 Subject: [PATCH 08/10] 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 d13a9a7c9e8..246ac2b0ea5 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -7,6 +7,7 @@ torch torchvision onnx onnxruntime +onnxscript openvino pytest pytest-forked @@ -26,4 +27,3 @@ accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark datasets==3.6.0 -onnxscript==0.5.4 From c8220f59520b5639e9421b9403e63a6c385860ee Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Wed, 12 Nov 2025 10:48:59 +0000 Subject: [PATCH 09/10] 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 0423a2db1d1..8874ed20a57 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 a0f7cf412bc..995267f68a2 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) From a4cfd126c4be1629597e0f299d07fbf7c2001105 Mon Sep 17 00:00:00 2001 From: Andrey Churkin Date: Thu, 8 Jan 2026 13:08:45 +0000 Subject: [PATCH 10/10] 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 246ac2b0ea5..7602099cea1 100644 --- a/tests/post_training/requirements.txt +++ b/tests/post_training/requirements.txt @@ -26,4 +26,4 @@ timm==0.9.2 accelerate==1.9.0 transformers==4.53.0 whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark -datasets==3.6.0 +datasets