From a6aa133d292c75efd3b8d8f6270c757b1cb34247 Mon Sep 17 00:00:00 2001 From: Andreas Fehlner Date: Fri, 3 Oct 2025 07:22:01 +0200 Subject: [PATCH 1/6] Update build-and-test.yml Signed-off-by: Andreas Fehlner --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 25fa754e1..46f72dc31 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-24.04, windows-2022, macos-15] - python: ["cp39", "cp310", "cp311", "cp312", "cp313"] + python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"] steps: - uses: actions/checkout@v5 with: From 4a069ef5e2475e1d6854298e2e460e653ad07deb Mon Sep 17 00:00:00 2001 From: Andreas Fehlner Date: Fri, 3 Oct 2025 07:48:34 +0200 Subject: [PATCH 2/6] Update build-and-test.yml Signed-off-by: Andreas Fehlner --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 46f72dc31..bfecf3304 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-24.04, windows-2022, macos-15] - python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"] + python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314-dev"] steps: - uses: actions/checkout@v5 with: From f39324514dd7db7bb13afdeec0baf3de3cf71078 Mon Sep 17 00:00:00 2001 From: Andreas Fehlner Date: Mon, 22 Dec 2025 20:24:51 +0100 Subject: [PATCH 3/6] Update Python versions in build matrix Signed-off-by: Andreas Fehlner --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index bfecf3304..46f72dc31 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-24.04, windows-2022, macos-15] - python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314-dev"] + python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"] steps: - uses: actions/checkout@v5 with: From faaf9208552751bc13348bc57ff462768a1a7502 Mon Sep 17 00:00:00 2001 From: Takeshi Watanabe Date: Tue, 30 Dec 2025 04:35:54 +0900 Subject: [PATCH 4/6] Update torch with cp314 support (#225) Signed-off-by: take-cheeze Signed-off-by: Andreas Fehlner Signed-off-by: Justin Chu Co-authored-by: Andreas Fehlner Co-authored-by: Justin Chu --- .github/workflows/build-and-test.yml | 10 +--------- onnxoptimizer/test/optimizer_test.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index afb648df1..5aaf12379 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -25,7 +25,7 @@ jobs: CIBW_TEST_REQUIRES_LINUX: pytest pytest-xdist flake8-pyproject mypy onnxruntime CIBW_TEST_REQUIRES_MACOS: pytest pytest-xdist CIBW_TEST_REQUIRES_WINDOWS: pytest pytest-xdist - CIBW_BEFORE_TEST_LINUX: pip install torch==2.6.0+cpu torchvision==0.21.0+cpu --index-url https://download.pytorch.org/whl/cpu + CIBW_BEFORE_TEST_LINUX: pip install onnxscript torch==2.9.1 torchvision==0.24.1 CIBW_TEST_COMMAND: pytest {project}/onnxoptimizer/test CIBW_TEST_COMMAND_LINUX: cd {project} && flake8p && pytest CIBW_TEST_SKIP: " *_arm64" @@ -94,14 +94,6 @@ jobs: with: name: artifact path: dist - - # TODO: get acccess for test.pypi - # - name: Publish distribution 📦 to Test PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # repository-url: https://test.pypi.org/legacy/ - # skip-existing: true - # attestations: true - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags/v') diff --git a/onnxoptimizer/test/optimizer_test.py b/onnxoptimizer/test/optimizer_test.py index bc4be37ad..cf4b9e839 100644 --- a/onnxoptimizer/test/optimizer_test.py +++ b/onnxoptimizer/test/optimizer_test.py @@ -4204,9 +4204,9 @@ def test_split_predict_and_lift_lexical_references_for_caffe2_backend(self): @unittest.skipUnless(has_tv, "This test needs torchvision") def test_torchvision_fasterrcnn_fpn(self): # type: () -> None model = tv.models.detection.fasterrcnn_resnet50_fpn(pretrained=False) - x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)] + x = (torch.rand(3, 300, 400), torch.rand(3, 500, 400)) with io.BytesIO() as f: - torch.onnx.export(model, x, f, opset_version=11) + torch.onnx.export(model, x, f, opset_version=18) model = onnx.load_model_from_string(f.getvalue()) self._optimized( model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True @@ -4216,9 +4216,9 @@ def test_torchvision_fasterrcnn_fpn(self): # type: () -> None @unittest.skipUnless(has_tv, "This test needs torchvision") def test_torchvision_maskrcnn_fpn_opset11(self): # type: () -> None model = tv.models.detection.maskrcnn_resnet50_fpn(pretrained=False) - x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)] + x = (torch.rand(3, 300, 400), torch.rand(3, 500, 400)) with io.BytesIO() as f: - torch.onnx.export(model, x, f, opset_version=11) + torch.onnx.export(model, x, f, dynamo=False) model = onnx.load_model_from_string(f.getvalue()) self._optimized( model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True @@ -4229,9 +4229,9 @@ def test_torchvision_maskrcnn_fpn_opset11(self): # type: () -> None @unittest.skipUnless(has_tv, "This test needs torchvision") def test_torchvision_keypointrcnn_fpn(self): # type: () -> None model = tv.models.detection.keypointrcnn_resnet50_fpn(pretrained=False) - x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)] + x = (torch.rand(3, 300, 400), torch.rand(3, 500, 400)) with io.BytesIO() as f: - torch.onnx.export(model, x, f, opset_version=11) + torch.onnx.export(model, x, f, opset_version=18) model = onnx.load_model_from_string(f.getvalue()) self._optimized( model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True @@ -4242,7 +4242,7 @@ def test_torchvision_shufflenet_v2(self): # type: () -> None model = tv.models.shufflenet_v2_x1_0(pretrained=False) x = torch.rand(1, 3, 224, 224) with io.BytesIO() as f: - torch.onnx.export(model, x, f) + torch.onnx.export(model, x, f, dynamo=False) model = onnx.load_model_from_string(f.getvalue()) self._optimized( model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True @@ -4253,7 +4253,7 @@ def test_torchvision_mnasnet(self): # type: () -> None model = tv.models.mnasnet1_0(pretrained=False) x = torch.rand(1, 3, 224, 224) with io.BytesIO() as f: - torch.onnx.export(model, x, f) + torch.onnx.export(model, x, f, dynamo=False) model = onnx.load_model_from_string(f.getvalue()) self._optimized( model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True @@ -4264,7 +4264,7 @@ def test_torchvision_deeplabv3(self): # type: () -> None model = tv.models.segmentation.deeplabv3_resnet50(pretrained=False) x = torch.rand(1, 3, 224, 224) with io.BytesIO() as f: - torch.onnx.export(model, x, f) + torch.onnx.export(model, x, f, dynamo=False) model = onnx.load_model_from_string(f.getvalue()) self._optimized( model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True From 2be966eb79ce10da64f27efb08e474ace416580d Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Mon, 29 Dec 2025 11:49:17 -0800 Subject: [PATCH 5/6] Update optimizer_test.py Signed-off-by: Justin Chu --- onnxoptimizer/test/optimizer_test.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/onnxoptimizer/test/optimizer_test.py b/onnxoptimizer/test/optimizer_test.py index cf4b9e839..04df856db 100644 --- a/onnxoptimizer/test/optimizer_test.py +++ b/onnxoptimizer/test/optimizer_test.py @@ -4212,17 +4212,17 @@ def test_torchvision_fasterrcnn_fpn(self): # type: () -> None model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True ) - # maskrcnn is only supported in opset 11 and higher - @unittest.skipUnless(has_tv, "This test needs torchvision") - def test_torchvision_maskrcnn_fpn_opset11(self): # type: () -> None - model = tv.models.detection.maskrcnn_resnet50_fpn(pretrained=False) - x = (torch.rand(3, 300, 400), torch.rand(3, 500, 400)) - with io.BytesIO() as f: - torch.onnx.export(model, x, f, dynamo=False) - model = onnx.load_model_from_string(f.getvalue()) - self._optimized( - model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True - ) + # # maskrcnn is only supported in opset 11 and higher + # @unittest.skipUnless(has_tv, "This test needs torchvision") + # def test_torchvision_maskrcnn_fpn_opset11(self): # type: () -> None + # model = tv.models.detection.maskrcnn_resnet50_fpn(pretrained=False) + # x = (torch.rand(3, 300, 400), torch.rand(3, 500, 400)) + # with io.BytesIO() as f: + # torch.onnx.export(model, x, f, dynamo=False) + # model = onnx.load_model_from_string(f.getvalue()) + # self._optimized( + # model, onnxoptimizer.get_fuse_and_elimination_passes(), fixed_point=True + # ) # keypointrcnn is only supported in opset 11 and higher @pytest.mark.xfail From 78a3bac60a85b3fbaf8ab99e2a920b96216521c2 Mon Sep 17 00:00:00 2001 From: Andreas Fehlner Date: Mon, 29 Dec 2025 21:36:31 +0100 Subject: [PATCH 6/6] Update build matrix to exclude Python 'cp314' Removed Python version 'cp314' from the build matrix. Signed-off-by: Andreas Fehlner --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 5aaf12379..dd1faadfd 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-24.04, windows-2022, macos-15] - python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"] + python: ["cp39", "cp310", "cp311", "cp312", "cp313"] steps: - uses: actions/checkout@v5 with: