onnx-rs
Library Listed
Zero-dependency ONNX model parser in Rust
- Downloads
- 453
- Dependents
- 5
- Stars
- 6
- Forks
- 0
- Contributors
- 1
- Commits
- 14
- Latest release
- 0.1.3 ·
About
Zero-dependency ONNX model parser and encoder in Rust. Parses .onnx files (protobuf wire format) directly into typed Rust structs without relying on prost, protobuf, or any other crate.
Usage
use onnx_rs::ast::*;
// Parse
let bytes = std::fs::read("model.onnx").unwrap();
let model = onnx_rs::parse(&bytes).unwrap();
let graph = model.graph.as_ref().unwrap();
for node in &graph.node {
match &node.op_type {
OpType::Conv => println!("found conv: {}", node.name),
OpType::Relu => println!("found relu: {}", node.name),
op => println!("{}: {}", op, node.name),
}
}
// Encode back to protobuf
let bytes = onnx_rs::encode(&model);
std::fs::write("output.onnx", &bytes).unwrap();
Features
- Zero dependencies — hand-rolled protobuf wire format decoder
- Typed AST —
OpTypeenum with 170+ standard ONNX operators,Custom(String)fallback for vendor ops - Full ONNX IR —
Model,Graph,Node,TensorProto,TypeProto(Tensor/Sequence/Map/Optional/SparseTensor),Attribute,Function,TrainingInfo - All 23 data types — including Float8 (e4m3fn, e5m2, etc.), Int4, Uint4, BFloat16
- Roundtrip encode/decode —
parse()andencode()are fully symmetric
Read the full README
Benchmarks
Measured on Apple Silicon. onnx-rs vs the official C++ protobuf implementation (via Python onnx package). Parse only — file I/O excluded.
| Model | Size | onnx-rs | C++ protobuf | Speedup |
|---|---|---|---|---|
| NLLB Decoder | 1.7 GB | 0.4ms | 55.3ms | 138x |
| NLLB Encoder | 1.5 GB | 0.2ms | 29.8ms | 149x |
| BGE Large | 1.2 GB | 0.3ms | 55.7ms | 186x |
| VGG-19 | 548 MB | 8.2ms | 8.5ms | 1.0x |
| GPT-2 | 523 MB | 0.3ms | 8.3ms | 28x |
| Swin Transformer | 422 MB | 2.6ms | 8.2ms | 3.1x |
| BERT-SQuAD | 415 MB | 0.1ms | 12.6ms | 126x |
| Donut Encoder | 297 MB | 2.2ms | 6.1ms | 2.8x |
| YOLOv4 | 245 MB | 0.1ms | 4.0ms | 40x |
| ResNet-152 | 230 MB | 3.9ms | 4.0ms | 1.0x |
| Mask R-CNN | 169 MB | 0.9ms | 3.7ms | 4.1x |
| Faster R-CNN | 168 MB | 0.7ms | 3.5ms | 5.0x |
| MiniLM-L6 | 86 MB | 0.1ms | 1.5ms | 15x |
| EfficientNet | 49 MB | 0.1ms | 0.9ms | 9x |
| Inception v2 | 42 MB | 0.1ms | 0.9ms | 9x |
Models using raw_data (the default for modern exporters like PyTorch) are parsed near-instantly via zero-copy borrows. Models using float_data (legacy packed floats) use bulk memcpy on little-endian platforms.
All 15 models roundtrip cleanly: onnx_rs::parse -> onnx_rs::encode -> validated by onnx.checker.check_model() in the official C++ implementation.
Run benchmarks locally:
cargo bench
License
MIT
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- None found
- No native code found
- Python bindings
- No Python binding crate found
- License
- MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Zero-dependency ONNX model parser in Rust |
453 downloads over 30 days | 5 | 6 | 0.1.3 | GPU support unknown | No native code found | MIT |
|
safetensors Featured
Provides functions to read and write safetensors which aim to be safer than their PyTorch counterpart. |
5,486,837 downloads over 30 days | 531 | 3,943 | 0.8.0 | GPU support unknown | No native code found | Apache-2.0 |
|
onnx-extractor Listed
Minimal ONNX model loader for extracting weights, tensors, operations, and graph structure |
3,975 downloads over 30 days | 4 | 6 | 0.5.2 | GPU support unknown | No native code found | MIT |
|
gguf Listed
GGUF file parser |
2,472 downloads over 30 days | 4 | 25 | 0.1.8 | GPU support unknown | No native code found | MIT |
|
One backbone, many specialists. CMF is a self-describing, memory-mappable single-file format and a dependency-free runtime for quantized LLMs — zero-copy execution on CPU or GPU (Vulkan · Metal · DX12) that overlays task-specialized skills onto one shared model, with no per-model duplication. |
24 binary downloads per release | Not applicable | 52 | Not measured | Not measured | Apache-2.0 | |
|
Model conversion and quantization with no Python: reads SafeTensors, GGUF, TCF and PyTorch state dicts, writes SafeTensors, GGUF and TCF, and quantizes to Q2_K through Q8_0 and IQ4 formats, including Q4_K_M mixes. GPTQ, AWQ, NF4, FP8, EXL2 and ONNX input are not implemented. Python bindings |
23 downloads over 30 days | Not applicable | 0 | 0.2.1 | GPU support unknown | No native code found | Apache-2.0 |
All projects in Datasets and model formatsAll projects in Run and serve models
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 4 active dependents and 4 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 6 stars, 0 forks and 1 contributor. It needs 4,539 stars, 434 forks and 79 contributors together.
What else the check found
- The last activity is on 9 Oct 2026, 31 days ago. The rules expect an update within 365 days. Dormancy rule
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.1.3 base 300, capped at 4 releases = 200, raised to the 365-day floor: E = 365 daysdormancy: last activity 2026-10-09, 31 days ago, E = 365: activefeatured: not featured: active_users 4 < 11 and new_adopters 4 < 9 and repository route stars 6 (needs 4539), forks 0 (needs 434), contributors 1 (needs 79)listed: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption4 active dependents, 4 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 4 | crates.io database dump | Yes | |
| New dependents (365 days) | 4 | crates.io database dump | Yes | |
| Peak active dependents | 4 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 31 days ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-10-09 | GitHub repository | Yes | |
| Latest release | 2026-10-09 | crates.io database dump | Yes | |
| First release | 2026-04-02 | crates.io database dump | Yes | |
| Latest version | 0.1.3 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 0 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 2 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution4 releases, 453 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 4 | crates.io database dump | Yes | |
| Downloads over 30 days | 453 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository6 stars, 0 forks, 1 contributors, 14 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 6 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 0 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 1 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 14 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 5 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.