Skip to content

Commit

Permalink
[TUZ-6] Add a direct Onnx to Relax Importer (apache#14)
Browse files Browse the repository at this point in the history
* Initial importer and testing scaffolding.

* Implement matmul operator and tests.

* Add a bunch of new operators.

* Add new ops

* [Relax][Onnx] Implement Div, Sigmoid, Softmax, Transpose and Unsqueeze ops

* skip test_reshape

* [Relax][ONNX] Implement BiasGelu and Gelu ops

* [Relax][ONNX] Implement Where op

* [Relax][ONNX] Add Multiple ONNX Frontend Support for Clip / Equal / Shape / Not / Tanh (#3)

* Rebase w/ Equal, Not, Tanh, Sqrt, Relu, Clip, Conv, Pow, Erf.

* Fix cumsum but still needs work.

* Fix initializer for CumSum. (#9)

* Add Constant, Squeeze & Sub (#10)

* Add squeeze.

* Add Constant.

* Add sub.

* Support reusing Relay ONNX operator convertors in the Relax ONNX frontend (#8)

* [WIP] Support using Relay ops in the Relax ONNX frontend

Co-authored-by: Matthew Barrett  <mbarrett@octoml.ai>
Co-authored-by: Michalis Papadimitriou <mpapadimitriou@octoml.ai>

* [WIP] small fixes

Co-authored-by: Matthew Barrett  <mbarrett@octoml.ai>
Co-authored-by: Michalis Papadimitriou <mpapadimitriou@octoml.ai>

* [WIP] Support dynamic matmul and reshape

Co-authored-by: Matthew Barrett  <mbarrett@octoml.ai>
Co-authored-by: Michalis Papadimitriou <mpapadimitriou@octoml.ai>

* Address PR comments

---------

Co-authored-by: Matthew Barrett  <mbarrett@octoml.ai>
Co-authored-by: Michalis Papadimitriou <mpapadimitriou@octoml.ai>

* Add more ops (including all Reduce ops) using the relay frontend (apache#11)

* [WIP] add more ops. Some fail at the moment

* skip some tests

* Remove duplicate tests for squeeze

* Add Split op in the Relax ONNX frontend (apache#12)

* [Relax][ONNX] Add Split op

* Remove tmp

* Fix layer normalizations and Shape operator.

* Replace main loop with tvm testing.

* Simplify Slice for opset 13.

* [Relax][ONNX] Implement pad op

* Incorporate pad op, add static constantofshape op.

* Changes to shape to temporarily enable constantofshape in our models.

* Add initial tensor_to_shape implementation.

* Implemented dynamic broadcast_to to support expand and constantofshape.

* Changes sufficient for vortex end to end run.

* Formatting.

* Format tests.

* Re-add broadcast_to shape checking.

* Fix formatting.

* Remove overly strict manipulate check.

* Fix typing

* [Relax][Onnx] Implement Tile operator

* Switch to native relax attention importer.

* Address some of the PR comments

* Check for the imported model IR version

* switch from torch to numpy due to some incompatibility

* Fix make format.

* Clean up typing issues.

* Clarify variable name.

* Remove unneeded comprehension.

* Remove circular dependency.

* Add name sanitization for inputs

* Disable reshape rewrite pass until fixed.

* Fix long comment

* Update cpu image.

---------

Co-authored-by: Florin Blanaru <fblanaru@octoml.ai>
Co-authored-by: Xiyou Zhou <xiyou@octoml.ai>
Co-authored-by: Matthew Barrett  <mbarrett@octoml.ai>
Co-authored-by: Michalis Papadimitriou <mpapadimitriou@octoml.ai>
Co-authored-by: Florin Blanaru <florin.blanaru96@gmail.com>
Co-authored-by: sung <sunggg@umich.edu>
  • Loading branch information
7 people committed Feb 28, 2023
1 parent 25b06ce commit a8b3700
Show file tree
Hide file tree
Showing 10 changed files with 2,873 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ $(foreach CMAKE_TARGET,$(CMAKE_TARGETS),$(eval $(GEN_CMAKE_RULE)))
# scripts that are executed in the CI should be in tests/lint. This
# allows docker/lint.sh to behave similarly to the CI.
format:
./tests/lint/git-clang-format.sh -i --rev origin/main
./tests/lint/git-clang-format.sh -i --rev origin/relax
black .
cd rust && which cargo && cargo fmt --all

Expand Down
2 changes: 1 addition & 1 deletion ci/jenkins/docker-images.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
[jenkins]
ci_arm: tlcpack/ci-arm:20230223-070143-a3b51f11b
ci_cortexm: tlcpackstaging/ci_cortexm:20230124-233207-fd3f8035c
ci_cpu: tlcpack/ci-cpu:20230223-070143-a3b51f11b
ci_cpu: tlcpack/ci-cpu:relax-20230217-001605-fcb3d9e71
ci_gpu: tlcpack/ci-gpu:20221128-070141-ae4fd7df7
ci_hexagon: tlcpack/ci_hexagon:20230127-185848-95fa22308
ci_i386: tlcpack/ci-i386:20221013-060115-61c9742ea
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

[mypy]
ignore_missing_imports = False
ignore_missing_imports = True
show_column_numbers = True
show_error_context = True
follow_imports = skip
Expand Down
3 changes: 3 additions & 0 deletions python/tvm/relax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
FuncStructInfo,
)

# Frontends
from .frontend.onnx_frontend import from_onnx

# pipeline
from .pipeline import get_pipeline

Expand Down
Loading

0 comments on commit a8b3700

Please sign in to comment.