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

Add option to use register_custom_ops_library from onnx #257

Closed thewh1teagle closed 1 month ago

thewh1teagle commented 1 month ago

The function allow register custom operators shared library from path.

This way we'll be able to use onnxruntime extensions even if they not enabled. That's how Pyhton / C# use the extensions. And the extensions DLL can be fetched from nuget manually / automatically.

https://github.com/microsoft/onnxruntime/blob/6ae7e02d3485850555233a4819842fbb64a1666a/onnxruntime/python/onnxruntime_pybind_state.cc#L1797

Update: I managed to use onnxruntime extensions operators by download https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime.Extensions Enable "operator-libraries" feature and call .with_operator_library("libortextensions.dylib") in the session creation.

Does the operators lib most match onnxruntime version?

decahedron1 commented 1 month ago

https://docs.rs/ort/2.0.0-rc.4/ort/struct.SessionBuilder.html#method.with_operator_library