-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-121] Docs page for ONNX module. #10140
Conversation
docs/api/python/contrib/onnx.md
Outdated
@@ -0,0 +1,111 @@ | |||
# ONNX API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ONNX-MXNet Converter API ?
Please check the rendered output and fix the markdown
I think this can be created as a notebook, which users can use as a tutorial
docs/api/python/contrib/onnx.md
Outdated
``` | ||
|
||
```eval_rst | ||
.. note:: **Install ONNX** which needs protobuf compiler to be installed separately. Please **follow the instructions to install ONNX** [here](https://github.com/onnx/onnx). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark down render check?
docs/api/python/contrib/onnx.md
Outdated
.. note:: **Install ONNX** which needs protobuf compiler to be installed separately. Please **follow the instructions to install ONNX** [here](https://github.com/onnx/onnx). | ||
``` | ||
|
||
This document describes the ONNX APIs in mxnet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ONNX-MXNet API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit confusing as we are not describing ONNX API's . May be something like
"This document describes APIs to support ONNX in MXNet"
docs/api/python/contrib/onnx.md
Outdated
mxnet.contrib.onnx.import_model | ||
``` | ||
|
||
## Import ONNX model into Mxnet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ONNX Model in MXNet
docs/api/python/contrib/onnx.md
Outdated
You can download the converted ONNX model from | ||
[here](https://s3.amazonaws.com/onnx-mxnet/examples/super_resolution.onnx). | ||
|
||
A pre-trained model in MXNet contains two elements: a symbolic graph, containing the model's network definition, and a binary file containing the model weights. You can import the ONNX model and get the symbol and parameters objects using "import_model" API as shown below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bulleted points
- Symbolic graph(with the extension .json) - containing the model's network definition
- Binary file(with the extension .params) - containing model weights.
..
docs/api/python/contrib/onnx.md
Outdated
|
||
``` | ||
# By default, 'input_0' is an input of the imported model. | ||
mod = mx.mod.Module(symbol=sym, data_names=['input_0'], context=mx.cpu(), label_names=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link to Module API/tutorial page, similarly others where useful
I am writing a tutorial on ONNX with MXNet, it would be nice if the docs show an example on how to load an ONNX model in Gluon using a symbolic block. |
@ThomasDelteil Will include it. As discussed on github, we will also eventually have an API for gluon import and that API will have its own documentation and example illustration. |
This is how the page renders - http://34.227.67.197/api/python/contrib/onnx.html |
docs/api/python/contrib/onnx.md
Outdated
|
||
## Overview | ||
|
||
[ONNX](https://onnx.ai/) is an open format to represent deep learning models. With ONNX as an intermediate representation, it is easier to move models between state-of-the-art tools and frameworks for training and inference.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra period
docs/api/python/contrib/onnx.md
Outdated
|
||
[ONNX](https://onnx.ai/) is an open format to represent deep learning models. With ONNX as an intermediate representation, it is easier to move models between state-of-the-art tools and frameworks for training and inference.. | ||
|
||
The `mxnet.contrib.onnx` package refers to the APIs and interfaces that implements ONNX model format support for Apache MXNet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implement
docs/api/python/contrib/onnx.md
Outdated
|
||
The `mxnet.contrib.onnx` package refers to the APIs and interfaces that implements ONNX model format support for Apache MXNet. | ||
|
||
With ONNX format support for MXNet, developers can build and train models with PyTorch, CNTK, or Caffe2, and import these models into MXNet to run them for inference and training using MXNet’s highly optimized engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify.
...train models with a variety of deep learning frameworks...
Then list the currently supported frameworks with bullets. (easier to maintain too, when we add more later)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this -
... train models with a variety of deep learning frameworks....
I have linked it to the supported tools page on the ONNX website. That way our page never gets outdated.
docs/api/python/contrib/onnx.md
Outdated
``` | ||
|
||
```eval_rst | ||
.. note:: To use this module developers need to **install ONNX**, which needs protobuf compiler, to be installed separately. Please follow the instructions to install ONNX - https://github.com/onnx/onnx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this installation instructions.
- learn how to load a pre-trained ONNX model file into MXNet. | ||
- run inference in MXNet. | ||
|
||
## Pre-requisite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plural, no dash
- run inference in MXNet. | ||
|
||
## Pre-requisite | ||
The code demonstration assumes that the following python packages are installed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example assumes...
sym, arg, aux = onnx_mxnet.import_model(onnx_model_file) | ||
``` | ||
|
||
We can now visualize the imported model( graphviz needs to be installed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space before ( not after
mod.set_params(arg_params=arg, aux_params=aux, allow_missing=True, allow_extra=True) | ||
``` | ||
|
||
Module API's forward method requires Batch of data as input. We will prepare the data in that format and feed it to the forward method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lower case b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GTG!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for this documentation and tutorial.
@nswamy - Are your requested changes addressed?
|
||
The `mxnet.contrib.onnx` package refers to the APIs and interfaces that implement ONNX model format support for Apache MXNet. | ||
|
||
With ONNX format support for MXNet, developers can build and train models with a [variety of deep learning frameworks](http://onnx.ai/supported-tools), and import these models into MXNet to run them for inference and training using MXNet’s highly optimized engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also for re training and transfer learning usecases right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
* ONNX Documentation * Fix rendering issues. * lint issues * fixing image links * Fix Aaron's comments * rerun CI due to unrelated failures.
* ONNX Documentation * Fix rendering issues. * lint issues * fixing image links * Fix Aaron's comments * rerun CI due to unrelated failures.
* ONNX Documentation * Fix rendering issues. * lint issues * fixing image links * Fix Aaron's comments * rerun CI due to unrelated failures.
* ONNX Documentation * Fix rendering issues. * lint issues * fixing image links * Fix Aaron's comments * rerun CI due to unrelated failures.
Description
Documentation page for ONNX module.
Checklist
Essentials
make lint
)Changes
Comments