Giter VIP home page Giter VIP logo

Comments (34)

wenbingl avatar wenbingl commented on July 18, 2024 4

@wenbingl @sayanshaw24 any pointer how to use the new change?

It will be available in Maven repo on the next ort-extensions 0.11 release, which will be early next month

from onnxruntime-extensions.

wenbingl avatar wenbingl commented on July 18, 2024 3

Just following up on this issue, has there been any updates? @wenbingl wenbingl

it's in the plan, and am looking for the resource and it could be done in the next month.

from onnxruntime-extensions.

wenbingl avatar wenbingl commented on July 18, 2024 2

@sayanshaw24 is working on a pipeline to compile JNI for multiple platforms into one Jar file now.

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024 2

The release on Maven Central of ORT extensions v0.11.0 contains x64 binaries for Windows, macOS and Linux, but ORT v1.18.0 contains binaries for arm64 macOS and Linux as well as the x64 binaries. I think support for building the arm64 binaries has been added to the project (at least on the build system side, not sure about the CI), is it possible to get them folded into the next release of ORT extensions on Maven Central?

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024 1

The name used in the gradle dependency is not the package name. You should still use import ai.onnxruntime.extensions.OrtxPackage;.

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024 1

It would be nice to get Java builds going for this, the stable diffusion sample code I released earlier this week tells users to compile this repo from source and copy the binary in which isn't particularly user friendly - https://github.com/oracle-samples/sd4j.

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024 1

Just following up on this issue, has there been any updates?
@wenbingl wenbingl

from onnxruntime-extensions.

EmergentOrder avatar EmergentOrder commented on July 18, 2024

+1

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@HichemMaiza I am facing a similar issue. I looked up your github link but does not seem understand clearly the steps to include onnxruntime-extensions in my Kotlin+Java project. For example, I do not have pom.xml in my project

I added this in my build.gradle.kts:

implementation("com.hichemmaiza.onnx:onnxruntime-extensions-java:0.10.0-SNAPSHOT")

I see this error:

Can you please further explain the steps?

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

I installed mvn3.9.5 from here , ran mvn clean install from your github repo
and saw the following:
image

Still not sure how to import this.

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

I added in my build.gradle.kts the following:

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
    // maven local
    mavenLocal()

}
dependencies {
implementation("com.hichemmaiza.onnx:onnxruntime-extensions-java:0.10.0-SNAPSHOT")
}

Not able yet to import it in my Kotlin+Java code to be able to use the library.
I tried this import com.hichemmaiza.onnx.*; . Tells me unresolved reference to hichemmaiza

Any help?

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

I did the import @Craigacp.. but that's the error I got:

/home/hossamamer/workspace/Emoji_workspace/Android-emoji/app/src/main/kotlin/EmojiPredictor.kt: (11, 34): Unresolved reference: OrtxPackage

Any clue?

from onnxruntime-extensions.

HichemMaiza avatar HichemMaiza commented on July 18, 2024

@HossamAmer12 as @Craigacp already mentioned, you need to do

import ai.onnxruntime.extensions.OrtxPackage; 
// ... 
OrtSession.SessionOptions  sessionOptions = new OrtSession.SessionOptions() ;
sessionOptions.registerCustomOpLibrary(OrtxPackage.getLibraryPath());

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@HichemMaiza I did this import but I still get the error. Also did the steps above

from onnxruntime-extensions.

HichemMaiza avatar HichemMaiza commented on July 18, 2024

@HossamAmer12 Thank you for your feedback, may I ask what OS are you using ?

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@HichemMaiza I am using WSL 2.0 on Windows OS.

from onnxruntime-extensions.

wenbingl avatar wenbingl commented on July 18, 2024

check here: https://github.com/microsoft/onnxruntime-extensions/tree/main/tutorials/demo4j, you may need to manully copy the jar file to app libs folder.

Publish jar file to Maven Central could be done in the late releases if the resource allows us to do so.

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@wenbingl I looked up the link and found this comment:
copy JAR package from $REPO/out/$OS/RelWithDebInfo/java/build/libs/onnxruntime-extensions-${VERSION}.jar into app/libs folder.

I could not find or locate the directory above. Any clue? or any chance you can share a jar file for 0.8 ORT-extensions?

from onnxruntime-extensions.

wenbingl avatar wenbingl commented on July 18, 2024

@wenbingl I looked up the link and found this comment: copy JAR package from $REPO/out/$OS/RelWithDebInfo/java/build/libs/onnxruntime-extensions-${VERSION}.jar into app/libs folder.

I could not find or locate the directory above. Any clue? or any chance you can share a jar file for 0.8 ORT-extensions?

The package was built from source, https://github.com/microsoft/onnxruntime-extensions/blob/main/java/README.md

I just verified the build is still OK, and shared the JAR file for experiment here: https://1drv.ms/u/s!AgQZTAPsze9AiM8lA6AfPF6bL7803Q?e=8Yt9UZ

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

Thanks @wenbingl
I created a libs folder in my project and pasted your JAR file into this folder. But I still get this import error. What do I need to do to ensure that JAR file is properly imported in my project?

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024

Is your grade build set to look for dependencies in the libs folder? That's not the default behaviour for regular non-android gradle builds.

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@Craigacp How can I do that?

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024

https://discuss.gradle.org/t/how-to-include-local-jar-file-in-gradle/37744/2

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

My build.gradle.kts should follow the kotlin way to include.

I followed this link:
https://stackoverflow.com/questions/54166069/how-do-you-add-local-jar-file-dependency-to-build-gradle-kt-file

The file with
import ai.onnxruntime.extensions.OrtxPackage was OK

As soon as I add this statement, it does not build:

 val sessionOptions = OrtSession.SessionOptions()
/* Register the custom ops from onnxruntime-extensions */
sessionOptions.registerCustomOpLibrary(OrtxPackage.getLibraryPath());

error:

(39, 5): Expecting member declaration

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024

That sounds like a Kotlin syntax problem rather than any issue with the library. Is the line registering the ops library inside a function or init block?

from onnxruntime-extensions.

wenbingl avatar wenbingl commented on July 18, 2024

OrtxPackage

check here: https://github.com/microsoft/onnxruntime-inference-examples/blob/45f8c0cdad97eefc1623b0044e9a4ac961343725/mobile/examples/super_resolution/android/app/src/main/java/ai/onnxruntime/example/superresolution/MainActivity.kt#L42

But I am not a Kotlin user, only see the difference between yours and theirs.

from onnxruntime-extensions.

HichemMaiza avatar HichemMaiza commented on July 18, 2024

@Craigacp Thank you for your contribution; I completely agree !!
I used ONNX to infer the Whisper model, and I didn't want to upload it before finding a solution to onnxruntime-extensions. Asking Java developers to compile the repo means we've already lost 90% of them.

from onnxruntime-extensions.

HichemMaiza avatar HichemMaiza commented on July 18, 2024

@wenbingl Great news !

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@wenbingl has there been any updates on this?

from onnxruntime-extensions.

HossamAmer12 avatar HossamAmer12 commented on July 18, 2024

@wenbingl @sayanshaw24 any pointer how to use the new change?

from onnxruntime-extensions.

karllessard avatar karllessard commented on July 18, 2024

Just by curiosity, any visibility on when 0.11 will then be released? Thank you

from onnxruntime-extensions.

wenbingl avatar wenbingl commented on July 18, 2024

Just by curiosity, any visibility on when 0.11 will then be released? Thank you

The release team is working on that, and the packages will be public in a couple of days.

from onnxruntime-extensions.

karllessard avatar karllessard commented on July 18, 2024

Thanks @wenbingl. Playing at building the JAR myself meanwhile, I realize that the current build conflicts with the onnxruntime release, as both are exported as Java module under the same name: com.microsoft.onnxruntime, as we can see here: https://github.com/microsoft/onnxruntime-extensions/blame/8d8670f7e87e9bb456b4b017879e8e4bb5aedfe3/java/build.gradle#L116

Hence, the compilation fails if I have a modular project depending on both com.microsoft.onnxruntime:onnxruntime and com.microsoft.onnxruntime:onnxruntime-extensions. Will that be fixed for the release?

from onnxruntime-extensions.

Craigacp avatar Craigacp commented on July 18, 2024

I made a PR to fix the module name #730.

from onnxruntime-extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.