You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Converts an ONNX model to ORT format and serializes it to C++ source code, generate custom slimmed ONNX Runtime static libs & xcframework for apple platforms.
The goal here is to create a flexible but tiny inference engine for a specific model e.g. iPlug2 example.
NOTE: due to risk of ODR violations, global/static variable conflicts, and dependency symbol clashes with DAW Hosts that use ORT themselves - think hard before you use this in an audio plugin!
The scripts here are configured to create a minimal ORT binary using only the CPU provider. If you want to experiment with GPU inference, Core ML etc, you will have to modify.
Run $ ./convert-model-to-ort.sh model.onnx
This converts the .onnx file to .ort and produces a .config file which slims the onnxruntime library build in the next step.
It also serializes the .ort format model to C++ source code, which can be used to bake the model into your app binary. If the model
is large this might not be a great solution, and it might be better to locate the .ort file at runtime.
Build customized onnx runtime static libraries
$ ./build-mac.sh
$ ./build-ios.sh
$ ./build-ios-simulator.sh
$ ./build-xcframework.sh
Note: windows static lib builds can get very large due to the LTO/LTCG settings in onnxruntime.
You can turn that off by applying the change in ltcg_patch_for_windows.patch to the onnxruntime repo.
Due to different MSVC runtimes for Debug and Release builds, we need to build two binaries for windows.