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

[ONNX] Foward port new mx2onnx into master #20355

Merged
merged 41 commits into from
Jul 16, 2021
Merged

Conversation

Zha0q1
Copy link
Contributor

@Zha0q1 Zha0q1 commented Jun 15, 2021

This pr forward ports all the new mx2onnx changes in v1.9.x (or v1.x as of 06/15/2020) and deprecates onnx2mx as discussed in #20063.

The expectation is that models generated with and exportable by MXNet v1.x should be continue to be able to export fine with MXNet 2.0.

Done:

  1. forward-port mx2onnx
  2. add operator tests (onnx updated to v1.8, onnxruntime updated to v1.7)
  3. add one model test (resnet 50)
  4. check mx2onnx wheel generation

TODO in future prs:

  1. identify new np and npx operators that need new conversion functions
  2. forward port gluoncv/gluonnlp model tests once they are compatible with MXNet 2.0

update on 06/30/2021
Since this pr 7152685 MXNet 2.0 is steering toward the new Gluon 2.0 interface and np and npx operators. This PR will also try to adapt the existing conversion functions to the new operators.

Supported Ops (WIP):

Np
absolute
zeros
ones
zeors_like
ones_like
full_like
arange
reshape(naive support)
concatenate
transpose
expand_dims
add
equal (missing scalar case)
not_equal (missing scalar case)
greater (missing scalar case)
less (missing scalar case)
greater_equal (missing scalar case)
less_equal (missing scalar case)
minimum
maximum
where
add (scalar)
subtract (scalar)
multiply (scalar)
divide (scalar)
power (scalar)


Npx
slice
arange_like
layer_norm
sequence_mask
reshape(naive support)
fully_connected
leaky_relu
activation
dropout
cast
softmax
box_nms
broadcast_greater
topk

@Zha0q1 Zha0q1 requested a review from szha as a code owner June 15, 2021 22:02
@mxnet-bot
Copy link

Hey @Zha0q1 , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [centos-gpu, windows-gpu, website, windows-cpu, clang, centos-cpu, miscellaneous, unix-gpu, unix-cpu, sanity, edge]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@mseth10 mseth10 added the pr-work-in-progress PR is still work in progress label Jun 15, 2021
@Zha0q1 Zha0q1 closed this Jun 15, 2021
@Zha0q1 Zha0q1 reopened this Jun 15, 2021
@Zha0q1 Zha0q1 changed the title [WIP][ONNX] Foward port new mx2onnx into master [ONNX] Foward port new mx2onnx into master Jun 16, 2021
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Jun 16, 2021
Copy link
Contributor

@waytrue17 waytrue17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Contributor

@leezu leezu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Few small questions: Can python/mxnet/onnx/mx2onnx/LICENSE be deleted, as mx2onnx is part of mxnet and not a separate project?

Comment on lines 405 to 406
### [GluonNLP](https://nlp.gluon.ai/model_zoo/catalog.html) Pretrained Model Support Matrix]
GluonNLP is a popular NLP toolkit built on top of MXNet. Below is the model support matrix for GluonNLP (v0.10.0) models.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GluonNLP v0.10 does not support MXNet 2. Have you tried with MXNet 2 / should the GluonNLP version be updated here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "forward port gluoncv/gluonnlp model tests once they are compatible with MXNet 2.0" from the PR description addresses my question. So mx2onnx currently supports exporting a symbol obtained via guonnlp 0.10 to onnx, it's just that we need mxnet 1 to export that symbol from gluonnlp 0.10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's correct, let me tweak the doc to note that explicitly thanks!

Comment on lines 113 to 116
# Dual-Licensed under Apache 2.0 and Nvidia BSD-3
'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',
Copy link
Contributor

@leezu leezu Jun 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dual licensed files should also be mentioned in the root LICENSE file. Further, as these files start with AL2 License text, why do you need to include them in license_header.py? If the license test fails, would it succeed if Line 17 (the line after end of AL2 text would be empty instead of #?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the op_translation files were originally developed by Nvidia I believe so they were dual licensed https://github.com/apache/incubator-mxnet/blob/97a2b609042e8594c6b1ad655a74f7eef585cfd0/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py. Let me also mention them in root LICENSE

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-awaiting-review PR is waiting for code review labels Jun 21, 2021
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Jul 15, 2021
@mseth10 mseth10 added pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review and removed pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress labels Jul 15, 2021
@Zha0q1 Zha0q1 merged commit 3480ba2 into apache:master Jul 16, 2021
barry-jin pushed a commit to barry-jin/incubator-mxnet that referenced this pull request Aug 4, 2021
* 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
barry-jin pushed a commit to barry-jin/incubator-mxnet that referenced this pull request Aug 4, 2021
* 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
barry-jin pushed a commit to barry-jin/incubator-mxnet that referenced this pull request Aug 4, 2021
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants