Pure Go bindings for ONNX Runtime using ebitengine/purego.
This library provides a pure Go interface to ONNX Runtime without requiring cgo, enabling cross-platform machine learning inference in Go applications.
NOTE: This project is currently unstable. APIs may change without notice.
This library also includes experimental support for ONNX Runtime GenAI, enabling text generation with large language models. See examples/genai/ for usage examples.
NOTE: You need to have the ONNX Runtime shared library installed on your system:
- macOS:
libonnxruntime.dylib - Linux:
libonnxruntime.so - Windows:
onnxruntime.dll
Download the appropriate library from the ONNX Runtime releases.
go get github.com/shota3506/onnxruntime-puregoThe examples/ directory contains complete examples:
- resnet: Image classification using ResNet
- roberta-sentiment: Sentiment analysis using RoBERTa
- yolov10: Object detection using YOLOv10
- genai: Text generation using ONNX Runtime GenAI (experimental)
See each example's README for detailed instructions.