Skip to content

Commit 5df0e3e

Browse files
committed
Update onnx-model.md
1 parent 1e1fbc0 commit 5df0e3e

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

burn-book/src/import/onnx-model.md

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
# Importing ONNX Models in Burn
22

3-
## Table of Contents
4-
5-
1. [Introduction](#introduction)
6-
2. [Why Import Models?](#why-import-models)
7-
3. [Understanding ONNX](#understanding-onnx)
8-
4. [Burn's ONNX Support](#burns-onnx-support)
9-
5. [ONNX Compatibility](#onnx-compatibility)
10-
6. [Step-by-Step Guide](#step-by-step-guide)
11-
7. [Advanced Configuration](#advanced-configuration)
12-
8. [Loading and Using Models](#loading-and-using-models)
13-
9. [Troubleshooting](#troubleshooting)
14-
10. [Examples and Resources](#examples-and-resources)
15-
11. [Conclusion](#conclusion)
16-
173
## Introduction
184

195
As deep learning evolves, interoperability between frameworks becomes crucial. Burn, a modern deep
@@ -68,19 +54,27 @@ version, you'll need to upgrade it using the ONNX version converter.
6854

6955
### Upgrading ONNX Models
7056

71-
You can upgrade your ONNX models with this simple Python script:
57+
There are two simple ways to upgrade your ONNX models to the required opset version:
58+
59+
Option 1: Use the provided utility script:
60+
61+
```
62+
uv run --script https://raw.githubusercontent.com/tracel-ai/burn/refs/heads/main/crates/burn-import/onnx-opset-upgrade.py
63+
```
64+
65+
Option 2: Use a custom Python script:
7266

7367
```python
7468
import onnx
7569
from onnx import version_converter
7670

77-
# Load your ONNX model
71+
# Load the ONNX model
7872
model = onnx.load('path/to/your/model.onnx')
7973

80-
# Convert the model to opset version 16
74+
# Upgrade to opset version 16
8175
converted_model = version_converter.convert_version(model, 16)
8276

83-
# Save the converted model
77+
# Save the upgraded model
8478
onnx.save(converted_model, 'upgraded_model.onnx')
8579
```
8680

0 commit comments

Comments
 (0)