Skip to content
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

Documentation: What are the main Java bindings? #2710

Open
crummyh opened this issue Jan 6, 2025 · 16 comments
Open

Documentation: What are the main Java bindings? #2710

crummyh opened this issue Jan 6, 2025 · 16 comments

Comments

@crummyh
Copy link
Contributor

crummyh commented Jan 6, 2025

In the main README, there is a "supported platforms" section with a link to the Java bindings. But further in the doc, in the Bindings section, there is a link to the Whisper-JNI repository. Are these bindings the same? If not, which is preferred?

Thanks!

@pavan901
Copy link

i also want to bind whisper cpp and java i got some error can you help in this

@crummyh
Copy link
Contributor Author

crummyh commented Jan 27, 2025 via email

@pavan901
Copy link

thanks bro please let me know detailed step when you free

@crummyh
Copy link
Contributor Author

crummyh commented Jan 28, 2025 via email

@crummyh
Copy link
Contributor Author

crummyh commented Jan 28, 2025 via email

@pavan901
Copy link

pavan901 commented Jan 28, 2025 via email

@crummyh
Copy link
Contributor Author

crummyh commented Jan 28, 2025

What do you mean by SST?

The docs have almost nothing, your best chance is to go into WhisperCppJnaLibrary.java and look there, or how it was done in the getFullDefaultParams() function in WhisperCpp.java. If you have a C++ example, you could try to translate it line by line. Or you can do what do what I did and write it C++ and transport the data through an a pipeline

@crummyh
Copy link
Contributor Author

crummyh commented Jan 28, 2025

To set up whisper-jni, I added this line to dependencies in build.gradle:

implementation 'io.github.givimad:whisper-jni:1.7.1'

WhisperJNI.java and io_github_givimad_whisperjni_WhisperJNI.h have some documentation, but not much.

@pavan901
Copy link

pavan901 commented Jan 29, 2025 via email

@crummyh
Copy link
Contributor Author

crummyh commented Jan 29, 2025

You might be able to use the other bindings in whisper.cpp/binding/java, or you could do something with the Java Android example. I haven't looked at it yet, but you might be able to use whisper.cpp in a similar way even when you aren't on Android.

@pavan901
Copy link

pavan901 commented Jan 30, 2025 via email

@crummyh
Copy link
Contributor Author

crummyh commented Jan 30, 2025

No matter what you do, you will need the whisper model and binary. The model is the main concern, and the whisper binary is much, much smaller. Right now I am looking at moonshine, which promises faster and more accurate transcription with resource-constrained devices. Right now the implementation is in Python, but you could be able to rewrite it in Java using Tersorflow Java. Right now moonshine only supports English, which might be an issue in production, but it is at least a start.

Moonshine might work better if you are doing transcription on the client side, on the server side a larger model might work better.

@crummyh
Copy link
Contributor Author

crummyh commented Jan 30, 2025

Note that this issue still stands, as it is not clear which Java Bindings are considered the "main" bindings.

@crummyh
Copy link
Contributor Author

crummyh commented Jan 30, 2025

https://github.com/bytedeco/javacpp might be an option for an alternative to the Java Bindings or Whisper-JNI. For moonshine, onnxruntime might be an option, but the current Python implementation uses huggingface_hub.hf_hub_download() to load the module, which would likely solve the size issues you talked about, but would have to be re-implemented in Java. It also requires tokenizers, which needs an alternative or a Java binding. einops.rearrange() needs to converted to Java as well.

@pavan901
Copy link

pavan901 commented Jan 31, 2025 via email

@pavan901
Copy link

pavan901 commented Jan 31, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants