Skip to content

Commit 8c24f77

Browse files
authored
Update deploy.md
1 parent edb01d6 commit 8c24f77

File tree

1 file changed

+20
-9
lines changed
  • content/learning-paths/servers-and-cloud-computing/onnx-on-azure

1 file changed

+20
-9
lines changed

content/learning-paths/servers-and-cloud-computing/onnx-on-azure/deploy.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout: learningpathall
88

99

1010
## ONNX Installation on Azure Ubuntu Pro 24.04 LTS
11-
Install Python, create a virtual environment, and use pip to install ONNX, ONNX Runtime, and dependencies. Verify the setup and validate a sample ONNX model like SqueezeNet.
11+
To work with ONNX models on Azure, you will need a clean Python environment with the required packages. The following steps install Python, set up a virtual environment, and prepare for ONNX model execution using ONNX Runtime.
1212

1313
### Install Python and Virtual Environment:
1414

@@ -26,41 +26,46 @@ source onnx-env/bin/activate
2626

2727
### Install ONNX and Required Libraries:
2828

29+
Upgrade pip and install ONNX with its runtime and supporting libraries:
2930
```console
3031
pip install --upgrade pip
3132
pip install onnx onnxruntime fastapi uvicorn numpy
3233
```
3334
This installs ONNX libraries along with FastAPI (web serving) and NumPy (for input tensor generation).
3435

3536
### Validate ONNX and ONNX Runtime:
36-
Create **version.py** as below:
37+
Once the libraries are installed, you should verify that both ONNX and ONNX Runtime are correctly set up on your VM.
3738

39+
Create a file named `version.py` with the following code:
3840
```python
3941
import onnx
4042
import onnxruntime
4143

4244
print("ONNX version:", onnx.__version__)
4345
print("ONNX Runtime version:", onnxruntime.__version__)
4446
```
45-
Now, run version.py:
47+
Run the script:
4648

4749
```console
4850
python3 version.py
4951
```
50-
You should see an output similar to:
52+
You should see output similar to:
5153
```output
5254
ONNX version: 1.19.0
5355
ONNX Runtime version: 1.23.0
5456
```
55-
### Download and Validate ONNX Model - SqueezeNet:
56-
SqueezeNet is a lightweight convolutional neural network (CNN) architecture designed to achieve comparable accuracy to AlexNet, but with fewer parameters and smaller model size.
57+
With this validation, you have confirmed that ONNX and ONNX Runtime are installed and ready on your Azure Cobalt 100 VM. This is the foundation for running inference workloads and serving ONNX models.
5758

59+
### Download and Validate ONNX Model - SqueezeNet:
60+
SqueezeNet is a lightweight convolutional neural network (CNN) architecture designed to provide accuracy close to AlexNet while using 50x fewer parameters and a much smaller model size. This makes it well-suited for benchmarking ONNX Runtime.
61+
Download the quantized model:
5862
```console
5963
wget https://github.com/onnx/models/raw/main/validated/vision/classification/squeezenet/model/squeezenet1.0-12-int8.onnx -O squeezenet-int8.onnx
6064
```
6165
#### Validate the model:
6266

63-
Create a **vaildation.py** file with the code below for validation for ONNX model:
67+
After downloading the SqueezeNet ONNX model, the next step is to confirm that it is structurally valid and compliant with the ONNX specification. ONNX provides a built-in checker utility that verifies the graph, operators, and metadata.
68+
Create a file named `validation.py` with the following code:
6469

6570
```python
6671
import onnx
@@ -69,10 +74,16 @@ model = onnx.load("squeezenet-int8.onnx")
6974
onnx.checker.check_model(model)
7075
print("✅ Model is valid!")
7176
```
72-
You should see an output similar to:
77+
Run the script:
78+
79+
```bash
80+
python3 validation.py
81+
```
82+
83+
You should see output similar to:
7384
```output
7485
✅ Model is valid!
7586
```
76-
This downloads a quantized (INT8) classification model, and validates its structure using ONNX’s built-in checker.
87+
With this validation, you have confirmed that the quantized SqueezeNet model is valid and ONNX-compliant. The next step is to run inference with ONNX Runtime and to benchmark performance.
7788

7889
ONNX installation and model validation are complete. You can now proceed with the baseline testing.

0 commit comments

Comments
 (0)