Burn ONNX 0.21.0: build-time ONNX import that generates plain Rust model code
Hi r/rust,
I'm one of the maintainers of burn-onnx, and I wrote up the release notes for burn-onnx 0.21.0, the ONNX importer for the Burn deep learning framework:
https://burn.dev/blog/release-burn-onnx-0.21.0/
The short version: burn-onnx imports ONNX models at build time and generates normal Rust/Burn code plus a .bpk weight file. There is no graph runtime or protobuf dependency at runtime; the generated forward pass is Rust code you can read, debug, and modify.
This release is the first one from the dedicated tracel-ai/burn-onnx repository, split out from Burn’s old burn-import crate. Some highlights:
- 160 supported ONNX operators
- 1,615 upstream ONNX backend tests vendored into CI
- 717 tests currently passing, with every gap tracked explicitly
- Opset coverage checks green across ONNX opsets 1 through 24
- Real-world model checks for models like SDXL, Qwen, Kokoro TTS, Depth-Pro, ModernBERT, YOLO, ResNet-50, CLIP, and Silero VAD
- Graph simplification passes, including attention pattern coalescing into Burn’s native attention primitive
- Support for external data files for large ONNX models
- New loading options for file-based, embedded, and caller-provided weights
The migration note is that new projects should use burn-onnx = "0.21" instead of burn-import, though the old crate remains as a shim.
I’d be happy to hear feedback from anyone working with ONNX, Rust ML, WASM/embedded inference, or generated Rust model code.