Skip to content

Commit af9e4eb

Browse files
titaiwangmsThiago Crepaldi
authored and
Thiago Crepaldi
committed
[ONNX 3] Add ONNX registry tutorial
Co-authored-by: Thiago Crepaldi <thiagofc@microsoft.com>
1 parent 0bcfce2 commit af9e4eb

14 files changed

+500
-7
lines changed
Loading
7.37 KB
Loading
12.4 KB
Loading
8.41 KB
Loading
22.1 KB
Loading
6.8 KB
Loading

advanced_source/super_resolution_with_onnxruntime.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
(optional) Exporting a Model from PyTorch to ONNX and Running it using ONNX Runtime
33
===================================================================================
44
5-
.. Note::
5+
.. note::
66
As of PyTorch 2.1, there are two versions of ONNX Exporter.
77
8-
* ``torch.onnx.dynamo_export`is the newest (still in beta) exporter based on the TorchDynamo technology released with PyTorch 2.0
9-
* ``torch.onnx.export`` is based on TorchScript backend and has been available since PyTorch 1.2.0
8+
* ``torch.onnx.dynamo_export`is the newest (still in beta) exporter based on the TorchDynamo technology released with PyTorch 2.0.
9+
* ``torch.onnx.export`` is based on TorchScript backend and has been available since PyTorch 1.2.0.
1010
1111
In this tutorial, we describe how to convert a model defined
1212
in PyTorch into the ONNX format using the TorchScript ``torch.onnx.export` ONNX exporter.

beginner_source/onnx/README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ ONNX
88
2. export_simple_model_to_onnx_tutorial.py
99
Export a PyTorch model to ONNX
1010
https://pytorch.org/tutorials/beginner/onnx/export_simple_model_to_onnx_tutorial.html
11+
12+
3. onnx_registry_tutorial.py
13+
Introduction to ONNX
14+
https://pytorch.org/tutorials/beginner/onnx/onnx_registry_tutorial.html

beginner_source/onnx/export_simple_model_to_onnx_tutorial.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# -*- coding: utf-8 -*-
22
"""
33
`Introduction to ONNX <intro_onnx.html>`_ ||
4-
**Export a PyTorch model to ONNX**
4+
**Export a PyTorch model to ONNX** ||
5+
`Introduction to ONNX Registry <onnx_registry_tutorial.html>`_
56
67
Export a PyTorch model to ONNX
78
==============================
@@ -104,7 +105,7 @@ def forward(self, x):
104105
export_output.save("my_image_classifier.onnx")
105106

106107
######################################################################
107-
# The ONNX file can be loaded back into memory and checked if it is well formed with the following code:
108+
# You can load the ONNX file back into memory and check if it is well formed with the following code:
108109

109110
import onnx
110111
onnx_model = onnx.load("my_image_classifier.onnx")

beginner_source/onnx/intro_onnx.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
**Introduction to ONNX** ||
3-
`Export a PyTorch model to ONNX <export_simple_model_to_onnx_tutorial.html>`_
3+
`Export a PyTorch model to ONNX <export_simple_model_to_onnx_tutorial.html>`_ ||
4+
`Introduction to ONNX Registry <onnx_registry_tutorial.html>`_
45
56
Introduction to ONNX
67
====================
@@ -32,13 +33,21 @@
3233
Dependencies
3334
------------
3435
36+
PyTorch 2.1.0 or newer is required.
37+
3538
The ONNX exporter depends on extra Python packages:
3639
3740
- `ONNX <https://onnx.ai>`_
3841
- `ONNX Script <https://onnxscript.ai>`_
3942
4043
They can be installed through `pip <https://pypi.org/project/pip/>`_:
4144
45+
.. note::
46+
This tutorial leverages `onnxscript <https://github.com/microsoft/onnxscript#readme>`__
47+
to create custom ONNX operators. onnxscript is a Python library that allows users to
48+
create custom ONNX operators in Python. It is a prerequisite learning material for
49+
this tutorial. Please make sure you have read the onnxscript tutorial before proceeding.
50+
4251
.. code-block:: bash
4352
4453
pip install --upgrade onnx onnxscript

0 commit comments

Comments
 (0)