Skip to content

docs: add java-llama.cpp to README.md - #2935

Merged
ggerganov merged 1 commit into
ggml-org:masterfrom
kherud:java-llama.cpp
Sep 1, 2023
Merged

ggerganov merged 1 commit into
ggml-org:masterfrom
kherud:java-llama.cpp

Conversation

@kherud

@kherud kherud commented Aug 31, 2023

Copy link
Copy Markdown
Contributor

Since not much has happened on the Java side so far, I'd like to add my repository. Hopefully as a starting point for further collaboration. It exposes the entire C API and for the major part Java glue code exists, including grammar parsing and sampling.

I decided to implement the binding using JNA. In general, JNI exists as an alternative, but this usually comes with increased deployment effort, which is somewhat against the philosophy of the project. There is also project panama, which looks awesome, but so far is only an early access feature.

@Peng-YM

Peng-YM commented Sep 1, 2023 •

Copy link
Copy Markdown

Wow this is so cool, I also made a Java binding for LLaMa.cpp independently, here is the link to my repo. The idea is basically the same, using JNI for accessing the native library. However, instead of manually writing the JNI glue codes (which is very boring and hard to keep up with the ⚡️ update speed of LLaMA.cpp 😃), I used the awesome javacpp project to generate them automatically. Everything works fine on my Mac with the latest GGUF model and GPU support.

If possible, I wish we could collaborate and build some cool stuff 😎

@kherud

kherud commented Sep 1, 2023

Copy link
Copy Markdown
Contributor Author

Hey @Peng-YM I would love to work together! I know javacpp but am not really familiar with it. However, I think there is value in having different Java bindings:

  • JNA and javacpp are pretty similar I think, a good trade-off between performance and development/deployment effort (both have code generators)
  • JNI probably has the best performance, but also the most development and deployment effort
  • Panama will hopefully combine all advantages in the future, but so far it is only an early access feature

I really appreciate your work and would like to acknowledge it somehow. However, at this point I think my repository is more suitable to include in the readme, as it implements more features and is publicly available via Maven. I absolutely welcome you to collaborate on the repository or hope we can find another solution (mabye list both in readme like the node bindings?). What do you think?

@ggerganov
ggerganov merged commit 49bb9cb into ggml-org:master Sep 1, 2023
@Peng-YM

Peng-YM commented Sep 1, 2023

Copy link
Copy Markdown

Hey @Peng-YM I would love to work together! I know javacpp but am not really familiar with it. However, I think there is value in having different Java bindings:

  • JNA and javacpp are pretty similar I think, a good trade-off between performance and development/deployment effort (both have code generators)
  • JNI probably has the best performance, but also the most development and deployment effort
  • Panama will hopefully combine all advantages in the future, but so far it is only an early access feature

I really appreciate your work and would like to acknowledge it somehow. However, at this point I think my repository is more suitable to include in the readme, as it implements more features and is publicly available via Maven. I absolutely welcome you to collaborate on the repository or hope we can find another solution (mabye list both in readme like the node bindings?). What do you think?

Yes, as you have mentioned, I think we just choose different trade-off. Very well done job! Would love to see more exciting things on LLMs for the Java ecosystem!

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

Successfully merging this pull request may close these issues.

3 participants