"git@developer.sourcefind.cn:OpenDAS/mmcv.git" did not exist on "5b0cdccc5c84470afbdb999d61c9da50cefe7d10"
Unverified Commit e337103f authored by David Fan's avatar David Fan Committed by GitHub
Browse files

Enable ONNX test in circle CI (#3144)

* Enable ONNX test in circle CI
parent 25e2085e
...@@ -145,6 +145,21 @@ jobs: ...@@ -145,6 +145,21 @@ jobs:
pip install --user --progress-bar off --editable . pip install --user --progress-bar off --editable .
python test/test_hub.py python test/test_hub.py
torch_onnx_test:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
pip install --user --progress-bar off numpy
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# need to install torchvision dependencies due to transitive imports
pip install --user --progress-bar off --editable .
pip install --user onnx
pip install --user -i https://test.pypi.org/simple/ ort-nightly==1.5.2.dev202012031
python test/test_onnx.py
binary_linux_wheel: binary_linux_wheel:
<<: *binary_common <<: *binary_common
docker: docker:
...@@ -1074,6 +1089,7 @@ workflows: ...@@ -1074,6 +1089,7 @@ workflows:
- python_type_check - python_type_check
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test
unittest: unittest:
jobs: jobs:
...@@ -1189,6 +1205,7 @@ workflows: ...@@ -1189,6 +1205,7 @@ workflows:
- python_type_check - python_type_check
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test
- binary_linux_wheel: - binary_linux_wheel:
cu_version: cpu cu_version: cpu
filters: filters:
......
...@@ -145,6 +145,21 @@ jobs: ...@@ -145,6 +145,21 @@ jobs:
pip install --user --progress-bar off --editable . pip install --user --progress-bar off --editable .
python test/test_hub.py python test/test_hub.py
torch_onnx_test:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
pip install --user --progress-bar off numpy
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# need to install torchvision dependencies due to transitive imports
pip install --user --progress-bar off --editable .
pip install --user onnx
pip install --user -i https://test.pypi.org/simple/ ort-nightly==1.5.2.dev202012031
python test/test_onnx.py
binary_linux_wheel: binary_linux_wheel:
<<: *binary_common <<: *binary_common
docker: docker:
...@@ -700,6 +715,7 @@ workflows: ...@@ -700,6 +715,7 @@ workflows:
- python_type_check - python_type_check
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test
unittest: unittest:
jobs: jobs:
...@@ -717,6 +733,7 @@ workflows: ...@@ -717,6 +733,7 @@ workflows:
- python_type_check - python_type_check
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test
{{ build_workflows(prefix="nightly_", filter_branch="nightly", upload=True) }} {{ build_workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}
docker_build: docker_build:
triggers: triggers:
......
...@@ -170,7 +170,7 @@ class ONNXExporterTester(unittest.TestCase): ...@@ -170,7 +170,7 @@ class ONNXExporterTester(unittest.TestCase):
input = torch.rand(3, 10, 20) input = torch.rand(3, 10, 20)
input_test = torch.rand(3, 100, 150) input_test = torch.rand(3, 100, 150)
self.run_model(TransformModule(), [(input,), (input_test,)], self.run_model(TransformModule(), [(input,), (input_test,)],
input_names=["input1"], dynamic_axes={"input1": [0, 1, 2, 3]}) input_names=["input1"], dynamic_axes={"input1": [0, 1, 2]})
def test_transform_images(self): def test_transform_images(self):
...@@ -382,12 +382,12 @@ class ONNXExporterTester(unittest.TestCase): ...@@ -382,12 +382,12 @@ class ONNXExporterTester(unittest.TestCase):
# Test exported model on images of different size, or dummy input # Test exported model on images of different size, or dummy input
self.run_model(model, [(images,), (test_images,), (dummy_image,)], input_names=["images_tensors"], self.run_model(model, [(images,), (test_images,), (dummy_image,)], input_names=["images_tensors"],
output_names=["outputs"], output_names=["outputs"],
dynamic_axes={"images_tensors": [0, 1, 2, 3], "outputs": [0, 1, 2, 3]}, dynamic_axes={"images_tensors": [0, 1, 2], "outputs": [0, 1, 2]},
tolerate_small_mismatch=True) tolerate_small_mismatch=True)
# Test exported model for an image with no detections on other images # Test exported model for an image with no detections on other images
self.run_model(model, [(dummy_image,), (images,)], input_names=["images_tensors"], self.run_model(model, [(dummy_image,), (images,)], input_names=["images_tensors"],
output_names=["outputs"], output_names=["outputs"],
dynamic_axes={"images_tensors": [0, 1, 2, 3], "outputs": [0, 1, 2, 3]}, dynamic_axes={"images_tensors": [0, 1, 2], "outputs": [0, 1, 2]},
tolerate_small_mismatch=True) tolerate_small_mismatch=True)
# Verify that paste_mask_in_image beahves the same in tracing. # Verify that paste_mask_in_image beahves the same in tracing.
...@@ -434,16 +434,16 @@ class ONNXExporterTester(unittest.TestCase): ...@@ -434,16 +434,16 @@ class ONNXExporterTester(unittest.TestCase):
self.run_model(model, [(images,), (test_images,), (dummy_image,)], self.run_model(model, [(images,), (test_images,), (dummy_image,)],
input_names=["images_tensors"], input_names=["images_tensors"],
output_names=["boxes", "labels", "scores", "masks"], output_names=["boxes", "labels", "scores", "masks"],
dynamic_axes={"images_tensors": [0, 1, 2, 3], "boxes": [0, 1], "labels": [0], dynamic_axes={"images_tensors": [0, 1, 2], "boxes": [0, 1], "labels": [0],
"scores": [0], "masks": [0, 1, 2, 3]}, "scores": [0], "masks": [0, 1, 2]},
tolerate_small_mismatch=True) tolerate_small_mismatch=True)
# TODO: enable this test once dynamic model export is fixed # TODO: enable this test once dynamic model export is fixed
# Test exported model for an image with no detections on other images # Test exported model for an image with no detections on other images
self.run_model(model, [(dummy_image,), (images,)], self.run_model(model, [(dummy_image,), (images,)],
input_names=["images_tensors"], input_names=["images_tensors"],
output_names=["boxes", "labels", "scores", "masks"], output_names=["boxes", "labels", "scores", "masks"],
dynamic_axes={"images_tensors": [0, 1, 2, 3], "boxes": [0, 1], "labels": [0], dynamic_axes={"images_tensors": [0, 1, 2], "boxes": [0, 1], "labels": [0],
"scores": [0], "masks": [0, 1, 2, 3]}, "scores": [0], "masks": [0, 1, 2]},
tolerate_small_mismatch=True) tolerate_small_mismatch=True)
# Verify that heatmaps_to_keypoints behaves the same in tracing. # Verify that heatmaps_to_keypoints behaves the same in tracing.
...@@ -483,13 +483,13 @@ class ONNXExporterTester(unittest.TestCase): ...@@ -483,13 +483,13 @@ class ONNXExporterTester(unittest.TestCase):
self.run_model(model, [(images,), (test_images,), (dummy_images,)], self.run_model(model, [(images,), (test_images,), (dummy_images,)],
input_names=["images_tensors"], input_names=["images_tensors"],
output_names=["outputs1", "outputs2", "outputs3", "outputs4"], output_names=["outputs1", "outputs2", "outputs3", "outputs4"],
dynamic_axes={"images_tensors": [0, 1, 2, 3]}, dynamic_axes={"images_tensors": [0, 1, 2]},
tolerate_small_mismatch=True) tolerate_small_mismatch=True)
self.run_model(model, [(dummy_images,), (test_images,)], self.run_model(model, [(dummy_images,), (test_images,)],
input_names=["images_tensors"], input_names=["images_tensors"],
output_names=["outputs1", "outputs2", "outputs3", "outputs4"], output_names=["outputs1", "outputs2", "outputs3", "outputs4"],
dynamic_axes={"images_tensors": [0, 1, 2, 3]}, dynamic_axes={"images_tensors": [0, 1, 2]},
tolerate_small_mismatch=True) tolerate_small_mismatch=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment