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.
| Library | Supported Version |
|---|---|
| ONNX Runtime | 1.23.x |
| ONNX Runtime GenAI | 0.11.x |
This library also includes experimental support for ONNX Runtime GenAI, enabling text generation with large language models. See examples/ for usage examples.
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.
The library will be automatically discovered if placed in standard system locations:
- macOS:
/usr/local/lib,/opt/homebrew/lib,/usr/lib - Linux:
/usr/local/lib,/usr/lib,/lib - Windows: Standard DLL search paths
Alternatively, you can specify a custom path when creating the runtime.
go get github.com/shota3506/onnxruntime-puregoSee the examples/ directory for complete usage examples.