Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[ONNX] Foward port new mx2onnx into master (#20355)
Browse files Browse the repository at this point in the history
* initial: forward port mx2onnx and remove onnx2mx

* fix sanity

* add onnx operator unit tests

* add test file

* add model test

* fix license & doc

* fix

* marching toward 2.0

* fix typo

* add more ops

* more ops

* more ops

* more ops

* fix softmax and sanity

* more ops

* more ops

* more ops

* naming

* more ops

* more ops

* more ops and bug fix

* more ops and skip unvisited tests

* fix sanity

* fix for onnx18

* more ops

* fix

* fix onnx 18

* more ops

* skip model test

* update read me

* more ops

* more ops

* more ops

* more ops

* more ops

* Update test_models.py
  • Loading branch information
Zha0q1 committed Jul 16, 2021
1 parent 8fd17ce commit 3480ba2
Show file tree
Hide file tree
Showing 29 changed files with 10,228 additions and 4,601 deletions.
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@
Apache-2.0 license + 3-clause BSD license
=======================================================================================

python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
python/mxnet/contrib/onnx/mx2onnx/export_onnx.py
python/mxnet/onnx/mx2onnx/_export_onnx.py
python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py
python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py

=======================================================================================
Apache-2.0 license + MIT License
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/install/requirements
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ graphviz<0.9.0,>=0.8.1
contextvars;python_version<"3.7"

# Optional dependencies
onnx==1.7.0
onnxruntime==1.4.0
onnx==1.8.0
onnxruntime==1.7.0
protobuf==3.14.0
scipy==1.4.1
tabulate==0.7.5
Expand Down
10 changes: 10 additions & 0 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,16 @@ cd_unittest_ubuntu() {
fi
}

unittest_ubuntu_python3_cpu_onnx() {
set -ex
export PYTHONPATH=./python/
export MXNET_SUBGRAPH_VERBOSE=0
export DMLC_LOG_STACK_TRACE_DEPTH=10

pytest --cov-report xml:onnx_unittest.xml --verbose tests/python/onnx/test_operators.py
pytest --cov-report xml:onnx_unittest.xml --cov-append --verbose tests/python/onnx/test_models.py
}

unittest_ubuntu_python3_cpu() {
set -ex
export PYTHONPATH=./python/
Expand Down
22 changes: 22 additions & 0 deletions ci/jenkins/Jenkins_steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def python3_ut(docker_container_name) {
}
}

def python3_ut_onnx(docker_container_name) {
timeout(time: max_time, unit: 'MINUTES') {
utils.docker_run(docker_container_name, 'unittest_ubuntu_python3_cpu_onnx', false)
}
}

def python3_ut_onednn(docker_container_name) {
timeout(time: max_time, unit: 'MINUTES') {
utils.docker_run(docker_container_name, 'unittest_ubuntu_python3_cpu_onednn', false)
Expand Down Expand Up @@ -724,6 +730,22 @@ def test_unix_python3_cpu_no_tvm_op(lib_name) {
}]
}

def test_unix_python3_onnx_cpu(lib_name) {
return ['Python3: ONNX-CPU': {
node(NODE_LINUX_CPU) {
ws('workspace/ut-python3-onnx-cpu') {
try {
utils.unpack_and_init(lib_name, mx_lib, true)
python3_ut_onnx('ubuntu_cpu')
utils.publish_test_coverage()
} finally {
utils.collect_test_results_unix('onnx_unittest.xml', 'tests_python3_onnx_cpu_unittest.xml')
}
}
}
}]
}

def test_unix_python3_onednn_cpu(lib_name) {
return ['Python3: ONEDNN-CPU': {
node(NODE_LINUX_CPU) {
Expand Down
1 change: 1 addition & 0 deletions ci/jenkins/Jenkinsfile_unix_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ core_logic: {

utils.parallel_stage('Tests', [
custom_steps.test_unix_python3_cpu('cpu'),
custom_steps.test_unix_python3_onnx_cpu('cpu'),
custom_steps.test_unix_python3_mkl_cpu('cpu_mkl'),
custom_steps.test_unix_python3_onednn_cpu('onednn_cpu'),
custom_steps.test_unix_python3_onednn_mkl_cpu('onednn_mkl_cpu'),
Expand Down
11 changes: 8 additions & 3 deletions python/mxnet/contrib/onnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
# under the License.
"""Module for ONNX model format support for Apache MXNet."""

from .onnx2mx.import_model import import_model, get_model_metadata
from .onnx2mx.import_to_gluon import import_to_gluon
from .mx2onnx.export_model import export_model
from ...onnx import export_model as export_model_

def export_model(*args, **kwargs):
print('Calling mxnet.contrib.onnx.export_model...')
print('Please be advised that the ONNX module has been moved to mxnet.onnx and '
'mxnet.onnx.export_model is the preferred path. The current path will be deprecated '
'in the upcoming MXNet v1.10 release.')
return export_model_(*args, **kwargs)
Loading

0 comments on commit 3480ba2

Please sign in to comment.