onnx
- Version:
1.9.0, 1.6.0
- Category:
ai
- Cluster:
Loki
Description
ONNX (Open Neural Network Exchange) is an open ecosystem for representing deep learning models across frameworks. The modules listed here provide ONNX 1.9.0 with PyTorch integration, allowing models trained with PyTorch to be exported to ONNX format for interoperability and inference in other runtimes.
Documentation
import torch
import torch.onnx
# Sample model export
model = torch.nn.Linear(10, 5)
dummy_input = torch.randn(1, 10)
torch.onnx.export(model, dummy_input, "model.onnx")
# Validate model
import onnx
onnx_model = onnx.load("model.onnx")
onnx.checker.check_model(onnx_model)
# View model structure
print(onnx.helper.printable_graph(onnx_model.graph))
Full documentation: - ONNX: https://onnx.ai/ - PyTorch ONNX export: https://pytorch.org/docs/stable/onnx.html
Examples/Usage
List available modules:
$ module avail onnx
Load the onnx module:
$ module load onnx-pytorch-py39-cuda11.2-gcc9/1.9.0
Check the loaded modules:
$ module list
Unload the onnx module:
$ module unload onnx-pytorch-py39-cuda11.2-gcc9/1.9.0
Installation
Source code is obtained from onnx