-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add ORT Extensions to Java and build with Gradle #18503
Comments
Did you import |
Thanks @Craigacp. Btw, I am adding the onnx code in a Kotlin file. I think that it should not matter much. I have this now in App.kt:
and in build.gradle.kts:
The errors are:
If I add:
Any clue? |
I don't think it's a good idea to have both |
Please note that the code that I am writing is a simple Kotlin and Jave code and not android code. I am wondering if this
only works for Android and not Kotlin+Java. Any other alternatives to run this? Do I have to run in Android? Can I just run it on my laptop? |
You shouldn't mix the Android and the regular Java jars, they aren't compatible. The Java source code itself is (mostly) the same, but the native code underneath is compiled differently. Unfortunately there aren't any Java binaries available for onnxruntime-extensions yet (see microsoft/onnxruntime-extensions#597), so you'll need to compile it from source on the platforms you care about. This isn't too hard, and in practice you don't even need to build the extensions jar you can just compile the extensions native library and load it as a custom op library. |
This isn't too hard, and in practice you don't even need to build the extensions jar you can just compile the extensions native library and load it as a custom op library.
|
@Craigacp I did some work on the other issue. Let's try to get some help over there |
Describe the documentation issue
I saw your tutorial here:
https://onnxruntime.ai/docs/extensions/
I added:
implementation("com.microsoft.onnxruntime:onnxruntime-extensions-android:latest.release")
I added:
import ai.onnxruntime.*
I added:
sessionOptions.registerCustomOpLibrary(OrtxPackage.getLibraryPath());
the last file gives me the error saying that the OrtxPackage does not exist. What is missing?
Page / URL
No response
The text was updated successfully, but these errors were encountered: