Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump bindings to 1.11.1 #113

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- run: rustup target install x86_64-apple-darwin
- run: rustup target install i686-pc-windows-msvc
- run: rustup target install x86_64-pc-windows-msvc
- run: rustup target install aarch64-apple-darwin
# ******************************************************************
- name: Download prebuilt archive (CPU, x86_64-unknown-linux-gnu)
uses: actions-rs/cargo@v1
Expand All @@ -53,7 +54,7 @@ jobs:
command: build
args: --target x86_64-apple-darwin
- name: Verify prebuilt archive downloaded (CPU, x86_64-apple-darwin)
run: ls -lh target/x86_64-apple-darwin/debug/build/onnxruntime-sys-*/out/onnxruntime-osx-x64-1.*.tgz
run: ls -lh target/x86_64-apple-darwin/debug/build/onnxruntime-sys-*/out/onnxruntime-osx-x86_64-1.*.tgz
# ******************************************************************
- name: Download prebuilt archive (CPU, i686-pc-windows-msvc)
uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -89,7 +90,15 @@ jobs:
command: build
args: --target x86_64-pc-windows-msvc
- name: Verify prebuilt archive downloaded (GPU, x86_64-pc-windows-msvc)
run: ls -lh target/x86_64-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-gpu-x64-1.*.zip
run: ls -lh target/x86_64-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-x64-gpu-1.*.zip
# ******************************************************************
- name: Download prebuilt archive (CPU, aarch64-apple-darwin)
uses: actions-rs/cargo@v1
with:
command: build
args: --target aarch64-apple-darwin
- name: Verify prebuilt archive downloaded (CPU, aarch64-apple-darwin)
run: ls -lh target/aarch64-apple-darwin/debug/build/onnxruntime-sys-*/out/onnxruntime-osx-arm64-1.*.tgz

test:
name: Test Suite
Expand All @@ -110,9 +119,9 @@ jobs:
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
os: windows-2019
- target: i686-pc-windows-msvc
os: windows-latest
os: windows-2019
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ To run this example ([`onnxruntime-sys/examples/c_api_sample.rs`](onnxruntime-sy

```sh
# Download the model (SqueezeNet 1.0, ONNX version: 1.3, Opset version: 8)
❯ curl -LO "https://github.com/onnx/models/raw/master/vision/classification/squeezenet/model/squeezenet1.0-8.onnx"
❯ curl -LO "https://github.com/onnx/models/raw/main/vision/classification/squeezenet/model/squeezenet1.0-8.onnx"
❯ cargo run --example c_api_sample
[...]
Finished dev [unoptimized + debuginfo] target(s) in 1.88s
Expand Down Expand Up @@ -150,7 +150,7 @@ To run this example ([`onnxruntime/examples/sample.rs`](onnxruntime/examples/sam

```sh
# Download the model (SqueezeNet 1.0, ONNX version: 1.3, Opset version: 8)
❯ curl -LO "https://github.com/onnx/models/raw/master/vision/classification/squeezenet/model/squeezenet1.0-8.onnx"
❯ curl -LO "https://github.com/onnx/models/raw/main/vision/classification/squeezenet/model/squeezenet1.0-8.onnx"
❯ cargo run --example sample
[...]
Finished dev [unoptimized + debuginfo] target(s) in 13.62s
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ keywords = ["neuralnetworks", "onnx", "bindings"]
[dependencies]

[build-dependencies]
bindgen = { version = "0.59", optional = true }
bindgen = { version = "0.60", optional = true }
ureq = "2.1"

# Used on Windows
Expand Down
37 changes: 18 additions & 19 deletions onnxruntime-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{
/// WARNING: If version is changed, bindings for all platforms will have to be re-generated.
/// To do so, run this:
/// cargo build --package onnxruntime-sys --features generate-bindings
const ORT_VERSION: &str = "1.8.1";
const ORT_VERSION: &str = "1.11.1";

/// Base Url from which to download pre-built releases/
const ORT_RELEASE_BASE_URL: &str = "https://github.com/microsoft/onnxruntime/releases/download";
Expand Down Expand Up @@ -178,7 +178,7 @@ fn extract_zip(filename: &Path, outpath: &Path) {
let mut file = archive.by_index(i).unwrap();
#[allow(deprecated)]
let outpath = outpath.join(file.sanitized_name());
if !(&*file.name()).ends_with('/') {
if !file.name().ends_with('/') {
println!(
"File {} extracted to \"{}\" ({} bytes)",
i,
Expand Down Expand Up @@ -310,33 +310,32 @@ struct Triplet {
impl OnnxPrebuiltArchive for Triplet {
fn as_onnx_str(&self) -> Cow<str> {
match (&self.os, &self.arch, &self.accelerator) {
// onnxruntime-win-x86-1.8.1.zip
// onnxruntime-win-x64-1.8.1.zip
// onnxruntime-win-arm-1.8.1.zip
// onnxruntime-win-arm64-1.8.1.zip
// onnxruntime-linux-x64-1.8.1.tgz
// onnxruntime-osx-x64-1.8.1.tgz
// onnxruntime-win-x86-1.11.1.zip
// onnxruntime-win-x64-1.11.1.zip
// onnxruntime-win-arm-1.11.1.zip
// onnxruntime-win-arm64-1.11.1.zip
// onnxruntime-linux-x64-1.11.1.tgz
// onnxruntime-osx-x86_64-1.11.1.tgz
// onnxruntime-osx-arm64-1.11.1.tgz
(Os::Windows, Architecture::X86, Accelerator::None)
| (Os::Windows, Architecture::X86_64, Accelerator::None)
| (Os::Windows, Architecture::Arm, Accelerator::None)
| (Os::Windows, Architecture::Arm64, Accelerator::None)
| (Os::Linux, Architecture::X86_64, Accelerator::None)
| (Os::MacOs, Architecture::X86_64, Accelerator::None) => Cow::from(format!(
| (Os::MacOs, Architecture::Arm64, Accelerator::None)
| (Os::Linux, Architecture::X86_64, Accelerator::None) => Cow::from(format!(
"{}-{}",
self.os.as_onnx_str(),
self.arch.as_onnx_str()
)),
// onnxruntime-win-gpu-x64-1.8.1.zip
// Note how this one is inverted from the linux one next
(Os::Windows, Architecture::X86_64, Accelerator::Gpu) => Cow::from(format!(
"{}-{}-{}",
(Os::MacOs, Architecture::X86_64, Accelerator::None) => Cow::from(format!(
"{}-x86_{}",
self.os.as_onnx_str(),
self.accelerator.as_onnx_str(),
self.arch.as_onnx_str(),
self.arch.as_onnx_str().trim_start_matches('x')
)),
// onnxruntime-linux-x64-gpu-1.8.1.tgz
// Note how this one is inverted from the windows one above
(Os::Linux, Architecture::X86_64, Accelerator::Gpu) => Cow::from(format!(
// onnxruntime-win-x64-gpu-1.11.1.zip
// onnxruntime-linux-x64-gpu-1.11.1.tgz
(Os::Linux, Architecture::X86_64, Accelerator::Gpu)
| (Os::Windows, Architecture::X86_64, Accelerator::Gpu) => Cow::from(format!(
"{}-{}-{}",
self.os.as_onnx_str(),
self.arch.as_onnx_str(),
Expand Down
6 changes: 3 additions & 3 deletions onnxruntime-sys/examples/c_api_sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ fn main() {
//*************************************************************************
// create session and load model into memory
// NOTE: Original C version loaded SqueezeNet 1.0 (ONNX version: 1.3, Opset version: 8,
// https://github.com/onnx/models/blob/master/vision/classification/squeezenet/model/squeezenet1.0-8.onnx)
// https://github.com/onnx/models/blob/main/vision/classification/squeezenet/model/squeezenet1.0-8.onnx)
// Download it:
// curl -LO "https://github.com/onnx/models/raw/master/vision/classification/squeezenet/model/squeezenet1.0-8.onnx"
// Reference: https://github.com/onnx/models/tree/master/vision/classification/squeezenet#model
// curl -LO "https://github.com/onnx/models/raw/main/vision/classification/squeezenet/model/squeezenet1.0-8.onnx"
// Reference: https://github.com/onnx/models/tree/main/vision/classification/squeezenet#model
let model_path = std::ffi::OsString::from("squeezenet1.0-8.onnx");

#[cfg(target_family = "windows")]
Expand Down
Loading