Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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')
Expand Down
36 changes: 18 additions & 18 deletions onnxoptimizer/test/optimizer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4204,34 +4204,34 @@ 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
)

# 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, opset_version=11)
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
@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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading