pykeio / ort

Fast ML inference & training for Rust with ONNX Runtime
https://ort.pyke.io/
Apache License 2.0
786 stars 91 forks source link

Can't use onnxruntime extensions #256

Closed thewh1teagle closed 1 month ago

thewh1teagle commented 1 month ago

Hey!

I'm trying to use model which requires onnx runtime extensions with ort. However when using with_extensions() it throw error.

I'm trying to replicate the following: main.py

Error

thread 'main' panicked at src/main.rs:7:10:
called `Result::unwrap()` on an `Err` value: CreateSessionOptions(Msg("EnableOrtCustomOps: Custom operators in onnxruntime-extensions are not enabled"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Code

use ort::{GraphOptimizationLevel, Session};

fn main() {
    let session = Session::builder()
        .unwrap()
        .with_extensions()
        .unwrap()
        .with_optimization_level(GraphOptimizationLevel::Level3)
        .unwrap()
        .with_intra_threads(4)
        .unwrap();
}

OS: macOS m1 ort version: 2.0.0-rc.4

decahedron1 commented 1 month ago

You'll need to compile ONNX Runtime from source with --use_extensions.

thewh1teagle commented 1 month ago

You'll need to compile ONNX Runtime from source with --use_extensions.

I'll try to compile it from source and enable it. Why do you prefer not to enable it? I see that also onnxruntime official builds doesn't include it and I'm wondering why. It has great potential in simplify models usage. for example with whisper I don't need encoder / decoder. single model does it all.

decahedron1 commented 1 month ago

Why do you prefer not to enable it?

Partially because the official builds don't. I don't want to ship builds of ONNX Runtime with any more features than what most developers will use; that would just waste downstream users' disk space. Bandwidth is also a concern (currently I'm fortunate enough to not be billed for egress bandwidth, but as ort grows this will likely change).

This is the 2nd issue in the history of this project mentioning onnxruntime-extensions (the first being the PR adding with_extensions), so I do not currently think the need for it is enough to warrant the cost on my end.

thewh1teagle commented 1 month ago

Maybe you could host the binaries in Github releases for free without limits. Thanks for explain.