Skip to content

Commit

Permalink
chore: update to ONNX Runtime v1.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Mar 9, 2025
1 parent e81a58c commit e92a226
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/custom-static-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
onnxruntime-branch:
type: string
description: "ONNX Runtime branch"
default: "v1.20.2"
default: "v1.21.0"
push:
paths:
- 'ort-sys/build.rs'
Expand All @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4
- name: Compile ONNX Runtime
run: |
git clone https://github.com/microsoft/onnxruntime --recursive --branch ${{ inputs.onnxruntime-branch || 'v1.20.2' }} --single-branch --depth 1
git clone https://github.com/microsoft/onnxruntime --recursive --branch ${{ inputs.onnxruntime-branch || 'v1.21.0' }} --single-branch --depth 1
cd onnxruntime
./build.sh --update --build --config Release --parallel --compile_no_warning_as_error --skip_submodule_sync
cd ..
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v4
- name: Compile ONNX Runtime
run: |
git clone https://github.com/microsoft/onnxruntime --recursive --branch ${{ inputs.onnxruntime-branch || 'v1.20.2' }} --single-branch --depth 1
git clone https://github.com/microsoft/onnxruntime --recursive --branch ${{ inputs.onnxruntime-branch || 'v1.21.0' }} --single-branch --depth 1
cd onnxruntime
./build.sh --update --build --config Release --parallel --compile_no_warning_as_error --skip_submodule_sync --minimal_build
cd ..
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exclude = [

[package]
name = "ort"
description = "A safe Rust wrapper for ONNX Runtime 1.20 - Optimize and accelerate machine learning inference & training"
description = "A safe Rust wrapper for ONNX Runtime 1.21 - Optimize and accelerate machine learning inference & training"
version = "2.0.0-rc.9"
edition = "2021"
rust-version = "1.80"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<hr />
<a href="https://app.codecov.io/gh/pykeio/ort" target="_blank"><img alt="Coverage Results" src="https://img.shields.io/codecov/c/gh/pykeio/ort?style=for-the-badge"></a> <a href="https://crates.io/crates/ort" target="_blank"><img alt="Crates.io" src="https://img.shields.io/crates/d/ort?style=for-the-badge"></a> <a href="https://opencollective.com/pyke-osai" target="_blank"><img alt="Open Collective backers and sponsors" src="https://img.shields.io/opencollective/all/pyke-osai?style=for-the-badge&label=sponsors"></a>
<br />
<a href="https://crates.io/crates/ort" target="_blank"><img alt="Crates.io" src="https://img.shields.io/crates/v/ort?style=for-the-badge&label=ort&logo=rust"></a> <img alt="ONNX Runtime" src="https://img.shields.io/badge/onnxruntime-v1.20.2-blue?style=for-the-badge&logo=cplusplus">
<a href="https://crates.io/crates/ort" target="_blank"><img alt="Crates.io" src="https://img.shields.io/crates/v/ort?style=for-the-badge&label=ort&logo=rust"></a> <img alt="ONNX Runtime" src="https://img.shields.io/badge/onnxruntime-v1.21.0-blue?style=for-the-badge&logo=cplusplus">
</div>

`ort` is an (unofficial) [ONNX Runtime](https://onnxruntime.ai/) 1.20 wrapper for Rust based on the now inactive [`onnxruntime-rs`](https://github.com/nbigaouette/onnxruntime-rs). ONNX Runtime accelerates ML inference and training on both CPU & GPU.
`ort` is an (unofficial) [ONNX Runtime](https://onnxruntime.ai/) 1.21 wrapper for Rust based on the now inactive [`onnxruntime-rs`](https://github.com/nbigaouette/onnxruntime-rs). ONNX Runtime accelerates ML inference and training on both CPU & GPU.

## 📖 Documentation
- [Guide](https://ort.pyke.io/)
Expand Down
2 changes: 1 addition & 1 deletion backends/candle/standalone/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ort-candle-standalone"
publish = false
version = "1.20.0"
version = "1.21.0"
edition = "2021"

[package.metadata.winresource]
Expand Down
4 changes: 2 additions & 2 deletions backends/candle/standalone/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ static API_BASE: ort_sys::OrtApiBase = ort_sys::OrtApiBase {
static API: ort_sys::OrtApi = ort_candle::api();

unsafe extern "system" fn get_version_string() -> *const ort_sys::c_char {
c"1.20[email protected]@0.1.0".as_ptr()
c"1.21[email protected]@0.1.0".as_ptr()
}

unsafe extern "system" fn get_api(version: u32) -> *const ort_sys::OrtApi {
if version <= 20 { &API as *const _ } else { core::ptr::null() }
if version <= 21 { &API as *const _ } else { core::ptr::null() }
}

#[no_mangle]
Expand Down
2 changes: 1 addition & 1 deletion backends/tract/standalone/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ort-tract-standalone"
publish = false
version = "1.20.0"
version = "1.21.0"
edition = "2021"

[package.metadata.winresource]
Expand Down
4 changes: 2 additions & 2 deletions backends/tract/standalone/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ static API_BASE: ort_sys::OrtApiBase = ort_sys::OrtApiBase {
static API: ort_sys::OrtApi = ort_tract::api();

unsafe extern "system" fn get_version_string() -> *const ort_sys::c_char {
c"1.20[email protected]@0.1.0".as_ptr()
c"1.21[email protected]@0.1.0".as_ptr()
}

unsafe extern "system" fn get_api(version: u32) -> *const ort_sys::OrtApi {
if version <= 20 { &API as *const _ } else { core::ptr::null() }
if version <= 21 { &API as *const _ } else { core::ptr::null() }
}

#[no_mangle]
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/migrating/version-mapping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Information about `ort`'s versioning and relation to ONNX Runtime v
## A note on SemVer
`ort` versions pre-2.0 were not SemVer compatible. From v2.0 onwards, breaking API changes are accompanied by a **major version update**.

Updates to the version of ONNX Runtime used by `ort` may occur on **minor** version updates, i.e. 2.0 ships with ONNX Runtime 1.20.2, but 2.1 may ship with 1.21.0. ONNX Runtime is generally forward compatible, but in case you require a specific version of ONNX Runtime, you should pin the minor version in your `Cargo.toml` using a [tilde requirement](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements):
Updates to the version of ONNX Runtime used by `ort` may occur on **minor** version updates, i.e. 2.0 ships with ONNX Runtime 1.21.0, but 2.1 may ship with 1.21.0. ONNX Runtime is generally forward compatible, but in case you require a specific version of ONNX Runtime, you should pin the minor version in your `Cargo.toml` using a [tilde requirement](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements):
```toml
[dependencies]
ort = { version = "~2.0", ... }
Expand All @@ -16,7 +16,7 @@ ort = { version = "~2.0", ... }

| **ort** | **ONNX Runtime** |
| -------- | ----------------:|
| v2.0.0+ | v1.20.2 |
| v2.0.0+ | v1.21.0 |
| v1.16.0-v1.16.2 | v1.16.0 |
| v1.15.0-v1.15.5 | v1.15.1 |
| v1.14.2-v1.14.8 | v1.14.1 |
Expand Down
2 changes: 1 addition & 1 deletion ort-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ort-sys"
description = "Unsafe Rust bindings for ONNX Runtime 1.20 - Optimize and Accelerate Machine Learning Inferencing"
description = "Unsafe Rust bindings for ONNX Runtime 1.21 - Optimize and Accelerate Machine Learning Inferencing"
version = "2.0.0-rc.9"
edition = "2021"
rust-version = "1.80"
Expand Down
2 changes: 1 addition & 1 deletion ort-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
};

#[allow(unused)]
const ONNXRUNTIME_VERSION: &str = "1.20.2";
const ONNXRUNTIME_VERSION: &str = "1.21.0";

const ORT_ENV_SYSTEM_LIB_LOCATION: &str = "ORT_LIB_LOCATION";
const ORT_ENV_SYSTEM_LIB_PROFILE: &str = "ORT_LIB_PROFILE";
Expand Down
35 changes: 19 additions & 16 deletions ort-sys/dist.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
train,cu12 x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+train+cu12.tgz AEB606E668CFF43D6C41E6102C8C21BC07FD7AD407773F3CB46D1B44FA0A00CD
cu12 x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+cu12.tgz 2B003E5BA5C7BE640050B33CF05DF346E21CF61DEA3B4A0CF2B79F0D311EBB11
train,cu12 x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+train+cu12.tgz F802F73A7888DECFD5C9D7B1F30DD35AA2B00CDE7534FD8F7F1F907C36FD5BED
cu12 x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+cu12.tgz 66D5C9D63649C32213B76CFAD9039BDDDFBD576CD9920112F5ECF730659B7AC4
train x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+train.tgz 8FE1C03E616143236EA63ED1E9111CE06CB0BCE003186B49617ACBE1275D3393
train aarch64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-pc-windows-msvc+train.tgz 9FFCB579E40326800418D7AD67DBF5BA114A8AA87159F35EFC0B8B7F9927983D
none x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc.tgz BE2F63709024B1277F2DB504C5EC4B82798BC08C676AB67CEE91AB56EB3A9423
none aarch64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-pc-windows-msvc.tgz 035FCAFFA88BAFD90C68522006375C47245390BE2087863980E9F094D5FF87F9
train aarch64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-unknown-linux-gnu+train.tgz 5547440757F0807742E9CAB71DB0BBCA4401DFE15450C813F1C2913909E5273A
none x86_64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-apple-darwin.tgz 71A3716481E2BD509D897E2B74B301FD556477FC948F12E1F2ADF0F0B99D1AB3
train x86_64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-apple-darwin+train.tgz 68B5293D7C254B891365D3E3A2ADE8493F365F6E5ABB424AF6DB0A598FDAC7F2
none aarch64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-unknown-linux-gnu.tgz E18B7DDC0796C29F0011B231FCB57BBB07D211863130E4B983B056E09ED7A796
train aarch64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-apple-darwin+train.tgz EDF8C55B0138024742B522DF66FEB3882121A2B93CA0A286292387C9B8EB88DA
train x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+train.tgz 554C9EDD9DD1B1D5688CCDC5E098C2DA06E06FCA74F0B170AC8DC6948731B671
none aarch64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-apple-darwin.tgz 0D9150C2F31E93FE13EFEE7CECFF71539D7625D2CB015B9741098A66007AC228
none x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu.tgz D5B29F989BF48D003440DD0D6870451D79A7AD12CF1F138BC87E293467980FF4
train,cu12 x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+train+cu12.tgz 9AD0706146BC0A6DFFF9235E8E8BA98DB85DE52AA1926219AFFCE7741861C4CE
cu12 x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+cu12.tgz F798F44BB0B31DB8AFD97EB3AE1704D39001B943B36DF56B7DF9162CA03719DA
train,cu12 x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+train+cu12.tgz EC0AEA76C4D18FF8192936CC42E041261EFB80A45373B1D3D92C022457F57E41
cu12 x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+cu12.tgz 6AC7F14B5BD999994CDE016E750243D7828C6B681056E5E75E688C6C984500F9
wgpu x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+wgpu.tgz D9554DEEE8D145F9371E6DF416BB3941D1934766C2B4900CBA8671B6697D5B3C
none aarch64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-pc-windows-msvc.tgz 8B59C4401BAAB1F25A7369B82E895BC1AABB5A51317C779707D2228E0E5DEEA2
train x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc+train.tgz 3C3B78AD623D3267A76F538DC17E5520668B64E8E873C1947937885E0C7895CD
train aarch64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-pc-windows-msvc+train.tgz 7FC3D4A036FFB4B32B61B6981AF5BE60EB5FB5A4CD2427BBC6611E39F644F446
none x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-pc-windows-msvc.tgz 28A69FE89E3B8B14AF859FFCC6345B89EB3FFEB73E793FEF2944DFE3544BE1B3
train aarch64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-unknown-linux-gnu+train.tgz C8969D1861A5D3DBE0C732E0833970CA973AF094DB59D3D5A3C3C8CC3A38EF8F
train aarch64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-apple-darwin+train.tgz 1114EA0DBA81BA550B0CCF9AC6CB44A21D28B400E70A3B952A9BFD6B7B7322DA
none wasm32-unknown-emscripten https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/wasm32-unknown-emscripten.tgz 24A0FF471F158273E0D58917FCDE8BE121698184B0F01ECA495F716149F3A3DA
none aarch64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-unknown-linux-gnu.tgz E0DB605798F4B78ED2E93E358F2BAF19E0B3A064C51467CCE27F394FD991E30F
train x86_64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-apple-darwin+train.tgz 9AB0FF168AD3F1DCC8D5C91706F4DDE48A24DE462B327599DF8432991CF354B0
wgpu x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+wgpu.tgz 3EED887EE5D46185E313FFA72756AFFE70C78B0C93633E14193D14247D08E6F0
train x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu+train.tgz 6BB87EBE3C821EC323EE78F917E6DFC9AEAF5F485AB2526B6254A39FFF5B9109
none x86_64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-apple-darwin.tgz 818F3620512A3F4F25068B496F5E583273D55F6D37A1D18B3A4906548C6C0824
none aarch64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/aarch64-apple-darwin.tgz 7A79E7D209B4010180306D75C4819AA12C7E378D40EEFA00D65E49E280ED8AD9
none x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/[email protected]/x86_64-unknown-linux-gnu.tgz D40DFF92B1994E57255337D36D78BA74E2DE6FB1FABB8BD7F72306EA83FE785F
4 changes: 3 additions & 1 deletion ort-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ extern crate core;
#[cfg(feature = "std")]
pub mod internal;

pub const ORT_API_VERSION: u32 = 20;
// note to future self, 1.22 will require the values returned by GetMapValueType, GetSequenceElementType, and
// GetOptionalContainedTypeInfo to be released with ReleaseTypeInfo
pub const ORT_API_VERSION: u32 = 21;

pub use core::ffi::{c_char, c_int, c_ulong, c_ulonglong, c_ushort, c_void};

Expand Down
2 changes: 1 addition & 1 deletion src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl EnvironmentBuilder {
/// Typically, only Windows builds of ONNX Runtime provided by Microsoft will have telemetry enabled.
/// Pre-built binaries provided by pyke, or binaries compiled from source, won't have telemetry enabled.
///
/// The exact kind of telemetry data sent can be found [here](https://github.com/microsoft/onnxruntime/blob/v1.20.2/onnxruntime/core/platform/windows/telemetry.cc).
/// The exact kind of telemetry data sent can be found [here](https://github.com/microsoft/onnxruntime/blob/v1.21.0/onnxruntime/core/platform/windows/telemetry.cc).
/// Currently, this includes (but is not limited to): ONNX graph version, model producer name & version, whether or
/// not FP16 is used, operator domains & versions, model graph name & custom metadata, execution provider names,
/// error messages, and the total number & time of session inference runs. The ONNX Runtime team uses this data to
Expand Down
2 changes: 1 addition & 1 deletion src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl MemoryInfo {

// All getter functions are (at least currently) infallible - they simply just dereference the corresponding fields,
// and always return `nullptr` for the status; so none of these have to return `Result`s.
// https://github.com/microsoft/onnxruntime/blob/v1.20.2/onnxruntime/core/framework/allocator.cc#L171
// https://github.com/microsoft/onnxruntime/blob/v1.21.0/onnxruntime/core/framework/allocator.cc#L181

/// Returns the [`MemoryType`] described by this struct.
/// ```
Expand Down

0 comments on commit e92a226

Please sign in to comment.