README 未说明依赖版本、模型下载或默认端口等细节,建议查阅官方 Guide 与 Examples
ort
pykeioApache-2.0活跃维护用 Rust 封装 ONNX Runtime,让 ONNX 模型在 Rust 里跑推理和训练都很快,适合需要低延迟、无 Python 依赖的部署场景。
Fast ML inference & training for ONNX models in Rust
cargo add ortREADME 未说明具体显存或 GPU 型号要求,仅称支持几乎所有硬件加速器,且轻量到可运行在用户设备上。
Rust 里跑 ONNX 模型推理和训练,把 PyTorch/TF 模型部署到端侧或数据中心
用 Rust 封装 ONNX Runtime,让 ONNX 模型在 Rust 里跑推理和训练都很快,适合需要低延迟、无 Python 依赖的部署场景。
核心能力
- 封装微软 ONNX Runtime 做硬件加速推理与训练
- 支持多种硬件加速器,也能跑在用户设备上
- 可加载 PyTorch/TensorFlow/Keras/scikit-learn/PaddlePaddle 导出的模型
- 除 ONNX Runtime 外还支持其他纯 Rust 运行时后端
容易踩的坑
- v2.0.0-rc.15最新正式版2026-10-19 · 2026-10-19 07:26 UTC
2.0.0-rc.15
💖 If you find
ortuseful, please consider supporting us on Open Collective 💖🤔 Need help upgrading? Ask questions in GitHub Discussions or in the pyke.io Discord server!
✨ Supporters get priority (<24h) issue resolution & support!
rc.15 fixes over 30 instances of undefined behavior and adds no new features. It is highly recommended to upgrade to rc.15 as soon as possible, as multiple memory leaks/memory safety issues were fixed.
Alternative backends will be updated sometime before Oct 23.
run_asyncnow only accepts owned inputs.ExecutionProviderLibrary::unregisterhas been removed. You can still unregister EP libraries via the unsafe-sysAPI.ValueRefMutno longer implementsDerefMuttoValue. It has the same methods as&mut Valueand can be used in the same places in theortAPI. It is recommended to takeValueRefMutanywhere you used to take&mut Value.InMemorySessionno longer implementsDerefMuttoSession. It has the same methods as&mut Session.Kernelnow requiresSend;ThreadManagerrequiresSend + Sync.SessionBuilder::with_external_initializer_file_in_memorynow takesArc<[u8]>instead ofCow<'static, [u8]>.
- v2.0.0-rc.142026-10-12 · 2026-10-12 20:34 UTC
查看更新说明
2.0.0-rc.14
💖 If you find
ortuseful, please consider supporting us on Open Collective 💖🤔 Need help upgrading? Ask questions in GitHub Discussions or in the pyke.io Discord server!
✨ Supporters get priority (<24h) issue resolution & support!
⚠️ Manual environments
ortreplaced the manualEnvironmentstruct withort::initall the way back in Nov 2023 with 2.0.0-alpha.1 (yes, before rc hell, we used to be in alpha hell). This was done because only one environment was allowed per process anyway. However, almost every other release since then, there has been some kind of issue stemming from the environment being stored as a global variable.The trouble caused by this now far outweighs the inconvenience of lugging around another variable everywhere, so in rc.14, you must always first create an
Environmentto start building sessions:// pre-rc.14 { // optional, even! ort::init().commit()?; let mut model = Session::builder()? .with_optimization_level(GraphOptimizationLevel::Level3)? .with_intra_threads(4)? .commit_from_file("yolov8m.onnx")?; } // rc.14 { let env = ort::init().build()?; // <-- must build an environment first let mut model = Session::builder(&env)? .with_optimization_level(GraphOptimizationLevel::Level3)? .with_intra_threads(4)? .commit_from_file("yolov8m.onnx")?; }Note that you don't need to hold onto
envunless you intend to create more sessions. Please refrain from storing environments or sessions as global variables -- we can't fix the issues that causes within ONNX Runtime! And library authors, please remember to allow the user to pass their ownEnvironment.✨ Rust 1.100 compatibility
rc.14 adds support for the upcoming v2 build dir layout that will ship in Rust 1.100. If you intend to update to Rust 1.100, you should upgrade to rc.14 as soon as possible, since older
ortversions will fail to build whencopy-dylibsis enabled.Note that, due to the new layout, tests will no longer be able to see dylibs copied by
copy-dylibs; you can try to useort::util::preload_dylibto manually set the path to provider dylibs instead.📦 You get a binary! You get a binary! Everyone gets binaries!
🟩 rc.14's prebuilt CUDA binaries add support for RTX 50xx/Blackwell cards on x64. We now also ship aarch64 builds for Jetson Orin/Thor, Grace Hopper/Blackwell, & DGX Spark! Turing & Ampere GPUs remain fully supported.
🟥 Team Red gets some love as well: we now have MIGraphX binaries on x64 Linux! In the future, we'll also ship Windows builds with the Vitis AI EP for NPU acceleration on Ryzen AI chips.
🟦 We didn't forget about Team Blue either! We're also shipping OpenVINO builds for Windows & Linux x64.
🤖 x64 Android binaries were also added to make simulation easier.
⚙️ Miscellaneous features
- https://github.com/pykeio/ort/commit/f2a5f73c9dd9ff3682303481cc792bf4669e3e94 Update to ONNX Runtime v1.31.0.
ort-webis updated to v1.30.0.
- https://github.com/pykeio/ort/commit/c1f6e09b39830c502ed42a1c87dd3d36aa113d28 Add
ort::util::probetoload-dynamicto check the version of ONNX Runtime before you try to load it. - https://github.com/pykeio/or
- https://github.com/pykeio/ort/commit/f2a5f73c9dd9ff3682303481cc792bf4669e3e94 Update to ONNX Runtime v1.31.0.
- v2.0.0-rc.132026-07-28 · 2026-07-28 08:13 UTC
查看更新说明
2.0.0-rc.13
💖 If you find
ortuseful, please consider sponsoring us on Open Collective 💖🤔 Need help upgrading? Ask questions in GitHub Discussions or in the pyke.io Discord server!
🎯 Execution provider clarity
EP structs like
ep::CUDAare now compile-time gated behind their respective Cargo feature flags. The EP feature flags only modifying runtime behavior was a common pain point, and this change bringsortin line with, like, every other Rust crate in existence.⚠️
ortwill now throw an error at link time ifdownload-binariesis enabled and no binaries contain all of the requested EPs. Previously, if you enabled a nonsensical combination likecuda+coreml,ortwould silently fall back to a CPU-only build. This caused great confusion as the only indicator of what went wrong was in log messages that don't show by default. A newlax-feature-matchingCargo feature will fallback to the closest fit instead of erroring.🍎 ONNX Runtime 1.28
rc.13skips ahead 4 ONNX Runtime versions to v1.28, bringing new operator support, bug & security fixes, and performance improvements.✖️ No CUDA 12
rc.13only ships CUDA 13 binaries, as ONNX Runtime has deprecated CUDA 12.🧩 Custom operator ergonomics
Custom operators have been reworked to have a more Rusty interface:
struct MyOperator; impl Operator for MyOperator { + type Kernel<'attr> = ort::operator::BoxedKernel<'attr>; fn name(&self) -> &str { "MyOperator" } - fn inputs(&self) -> Vec<OperatorInput> { - vec![OperatorInput::required(TensorElementType::Float32), OperatorInput::required(TensorElementType::Float32)] + fn inputs(&self) -> impl IntoIterator<Item = OperatorInput> { + [OperatorInput::required(TensorElementType::Float32), OperatorInput::required(TensorElementType::Float32)] } - fn outputs(&self) -> Vec<OperatorOutput> { - vec![OperatorOutput::required(TensorElementType::Float32)] + fn outputs(&self) -> impl IntoIterator<Item = OperatorOutput> { + [OperatorOutput::required(TensorElementType::Float32)] } - fn create_kernel(&self, _: &KernelAttributes) -> ort::Result<Box<dyn Kernel>> { - Ok(Box::new(|ctx: &KernelContext| { + fn create_kernel<'attr>(&self, _: &KernelContext<'attr>) -> ort::Result<Self::Kernel<'attr>> { + Ok(Box::new(|ctx: &ComputeContext| { ... })) } }ℹ️ Custom diagnostic messages
ortnow uses the wonderful#[diagnostic]attributes to drastically improve the clarity of commonly encountered errors.☑️ Miri-approved
Test coverage was expanded and
ortwas ran against Miri, and a few unsoundness bugs were fixed.✨ Other features
- https://github.com/pykeio/ort/commit/8db51e7684f36615fb2a822f90e235a70d765b53 Add VSINPU EP
- https://github.com/pykeio/ort/commit/5688cce9a01f17fa88b613f603766e2b6052304d (
ort-web): Allow creating tensors from images. - https://github.com/pykeio/ort/commit/726dc7c47d8e0b2548885f796062b0b6d32d892e Expose the DirectML EP API.
- https://github.com/pykeio/ort/commit/5e669f6944911bb3fc34014680ec91f74cee30a0 Support string array operator attributes
- https://github.com/pykeio/ort/commit/5f99738620a1ee5d40aca7d90ab65bc4d295538f Support float16 tensor usage with the native
f16type on nightly Rust - https://github.com/pykeio/ort/commit/62ad710a5861b1722e9041ae730837547f85375e (
ort-candle): Updatecandleto 0.11 - https://github.com/pykeio/ort/commit/d5dc28f2f50c96d0e0cdcc668f3a23462f2b94dc (
ort-tract): Updatetractto 0.23
🔧 Other fixes
- https://github.com/pykeio/ort/commit/d5eb59f2ff5a597e0666b2d0cb8a901ffe54742e Committing a session which has a map input/output will
- v2.0.0-rc.122026-03-05 · 2026-03-05 05:41 UTC
查看更新说明
2.0.0-rc.12
💖 If you find
ortuseful, please consider sponsoring us on Open Collective 💖🤔 Need help upgrading? Ask questions in GitHub Discussions or in the pyke.io Discord server!
This release was made possible by Rime.ai!
Authentic AI voice models for enterprise.
📍 Multiversioning
🚨 If you used
ortwithdefault-features = false, enable theapi-24feature to use the latest features.The big highlight of this release is multiversioning:
ortcan now use any minor version of ONNX Runtime from v1.17 to v1.24. New features are gated behindapi-*feature flags, likeapi-20orapi-24. These flags will set the minimum version of ONNX Runtime required byort.More info 👉 https://ort.pyke.io/setup/multiversion
🪄 Automatic device selection
With ONNX Runtime 1.22 or later,
ortwill now automatically use an NPU if one is available for maximum efficiency & power savings! Setting your own execution providers will override this.This is thanks to the super cool new
SessionBuilder::with_auto_deviceAPI! There's alsoSessionBuilder::with_devicesfor finer control.👁️ CUDA 13
ortnow ships builds for both CUDA 12 & CUDA 13! It should automatically detect which CUDA you're using, but if it gets it wrong, you can override it by setting theORT_CUDA_VERSIONenvironment variable to12or13.🩹
SessionBuildererror recoveryYou can now recover from errors when building a session by calling
.recover()on the error type to get theSessionBuilderback.🛡️ Build attestations
Prebuilt binaries are now attested via GitHub Actions, so you can verify that they are untampered builds of ONNX Runtime coming straight from pyke.io.
To verify, download your binary package of choice and use the
ghCLI to verify:➜ gh attestation verify --owner pykeio ./x86_64-pc-windows-msvc+cu13.tar.lzma2 Loaded digest sha256:e96616510082108be228ad6ea026246a31650b7d446b330c6b9671fcb9ae6267 for file://./x86_64-pc-windows-msvc+cu13.tar.lzma2 Loaded 1 attestation from GitHub API The following policy criteria will be enforced: - OIDC Issuer must match:................... https://token.actions.githubusercontent.com - Source Repository Owner URI must match:... https://github.com/pykeio - Predicate type must match:................ https://slsa.dev/provenance/v1 - Subject Alternative Name must match regex: (?i)^https://github.com/pykeio/ ✓ Verification succeeded! sha256:e96616510082108be228ad6ea026246a31650b7d446b330c6b9671fcb9ae6267 was attested by: REPO PREDICATE_TYPE WORKFLOW pykeio/ort-artifacts https://slsa.dev/provenance/v1 .github/workflows/build-runner.yml@refs/heads/main(Also note that the SHA-256 hash lines up with the one defined in
dist.txt.)
Moving stuff around
- The
ORT_LIB_LOCATIONenvironment variable has been renamed toORT_LIB_PATH.- Same with all other env vars ending in
_LOCATION. - The old names will continue to work, but they won't make it into v2.0.0, so it's a good idea to change them now!
- Same with all other env vars ending in
- Everything that used to be in
ort::tensoris now inort::value, because why have atensormodule if theTensor<T>type actually comes from thevaluemodule? IoBindingandAdapterwere moved from their own modules intoort::session. All sub-modules
- The
- v2.0.0-rc.112026-01-07 · 2026-01-07 21:40 UTC
查看更新说明
💖 If you find
ortuseful, please consider sponsoring us on Open Collective 💖🤔 Need help upgrading? Ask questions in GitHub Discussions or in the pyke.io Discord server!
I'm sorry it took so long to get to this point, but the next big release of
ortshould be, finally, 2.0.0 🎉. I know I said that about one of the old alpha releases (if you can even remember those), but I mean it this time! Also, I would really like to not have to do another major release right after, so if you have any concerns about any APIs, please speak now or forever hold your peace!A huge thank you to all the individuals who have contributed to the Collective over the years: Marius, Urban Pistek, Phu Tran, Haagen, Yunho Cho, Laco Skokan, Noah, Matouš Kučera, mush42, Thomas, Bartek, Kevin Lacker, & Okabintaro. You guys have made these past rc releases possible.
If you are a business using
ort, please consider sponsoring me. Egress bandwidth from pyke.io has quadrupled in the last 4 months, and 90% of that comes from just a handful of businesses. I'm lucky enough that I don't have to pay for egress right now, but I don't expect that arrangement to last forever. pyke &orthave been funded entirely from my own personal savings for years, and (as I'm sure you're well aware 😂) everything is getting more expensive, so that definitely isn't sustainable.Seeing companies that raise tens of millions in funding build large parts of their business on
ort, ask for support, and then not give anything back just... seems kind of unfair, no?
ort-webort-weballows you to use the fully-featured ONNX Runtime on the Web! This time, it's hack-free and thus here to stay (it won't be removed, and then added back, and then removed again like last time!)See the crate docs for info on how to port your application to
ort-web; there is a little bit of work involved. For a very barebones sample application, seeort-web-sample.Documentation for
ort-web, like the rest ofort, will improve by the time 2.0.0 comes around. If you ever have any questions, you can always reach out via GitHub Discussions or Discord!Features
5d85209Add WebNN & WASM execution providers forort-web.#430(💖 @jhonboy121) Support statically linking to iOS frameworks.#433(💖 @rMazeiks) Implement more traits forGraphOptimizationLevel.6727c98MakePrepackedWeightsSend + Sync.15bd15cMake the TLS backend configurable with newtls-*Cargo features.f3cd995Allow overriding the cache dir with theORT_CACHE_DIRenvironment variable.- 🚨
8b3a1edLoad the dylib immediately when usingort::init_from.- You can now detect errors from dylib loading and let your program react accordingly.
- 🚨
#484(💖 @michael-p) Updatendarrayto v0.17.- This means you'll need to upgrade your
ndarraydependency to v0.17, too.
- This means you'll need to upgrade your
- [**`0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
ort is a Rust interface for performing hardware-accelerated inference & training on machine learning models in the Open Neural Network Exchange (ONNX) format.
Based on the now-inactive onnxruntime-rs crate, ort is primarily a wrapper for Microsoft's ONNX Runtime library, but offers support for other pure-Rust runtimes.
ort with ONNX Runtime is super quick - and it supports almost any hardware accelerator you can think of. Even still, it's light enough to run on your users' devices.
When you need to deploy a PyTorch/TensorFlow/Keras/scikit-learn/PaddlePaddle model either on-device or in the datacenter, ort has you covered.
📖 Documentation
🤔 Support
🌠 Backers
💖 FOSS projects using ort
Open a PR to add your project here 🌟
- Text Embeddings Inference (TEI) uses
ortto deliver high-performance ONNX Runtime inference for text embedding models. - Magika uses
ortfor neural network-based file type detection. - retto uses
ortfor reliable, fast ONNX inference of PaddleOCR models on Desktop and WASM platforms. - edge-transformers uses
ortfor accelerated transformer model inference at the edge. sbv2-apiis a fast implementation of Style-BERT-VITS2 text-to-speech usingort.- BoquilaHUB uses
ortfor local AI deployment in biodiversity conservation efforts. - CamTrap Detector uses
ortto detect animals, humans and vehicles in trail camera imagery. - Ortex uses
ortfor safe ONNX Runtime bindings in Elixir. - oar-ocr A comprehensive OCR library, built in Rust with
ortfor efficient inference. FastEmbed-rsusesortfor generating vector embeddings, reranking locally.- Ahnlich uses
ortto power their AI proxy for semantic search applications. - nicegal is a desktop image gallery app that uses
ortfor OCR & semantic image search. - Murmure uses
ortas its core engine, leveraging NVIDIA Parakeet to deliver fully local, free, private and cross‑platform Speech‑to‑Text enhanced with LLM post‑processing. - Valentinus uses
ortto provide embedding model inference inside LMDB. - SilentKeys uses
ortfor fast, on-device real-time dictation with NVIDIA Parakeet and Silero VAD. - Xybrid uses
ortto run LLMs, ASR, and TTS natively on-device across iOS, Android, Flutter, and Unity apps and games. - Ultralytics YOLO Rust Inference is a high-performance, pure Rust library and CLI providing a fast and efficient interface for running YOLO models using
ort. - Air Paint uses
ortto run a YOLO hand pose model for real-time air drawing.