Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds inferencing using an ONNX model.
It depends largely on the presence of the ONNX model weights.
NB: The rest of the instructions in this description should be run in the inference dir. You can do this by running
cd inference. Also, the onnx runtime and cargo builds are targeted at abi arm64-v8a and api level 27.The model weights can be gotten by running:
This would create two files in the output dir. One with an extension
.onnxand another with.onnx_data. You only need to point to the.onnxfile, as it points to.onnx_datainternallyThe model weights can then be used by specifying the path via the env var
ACHO_MODEL_PATH.Host Device Run
Hence, usage via cargo run on the host device can be done via:
ACHO_MODEL_PATH=<output_dir>/model.onnx cargo runBuilding a Binary for Android
Building for Android requires the ONNX runtime built for the target device.
This can be done via the
just onnx-build-runtimerecipe. However, the build for arm64-v8a and api level 27 already exists on Google drive. It is recommended to downloaded directly viajust onnx-download-runtime arm64-v8a 27 onnx_runtimes.When you have the runtime, the build can then be done with:
This would create a binary release that can be found at:
target/aarch64-linux-android/release/inferenceNB: You can download the android SDK zip file from: https://developer.android.com/ndk/downloads. Version r27d was used in builds for this PR.
Running the Binary via adb
After connecting to your device via adb, you need to do the following:
This can be done via: