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

Go bindings #351

Closed
mudler opened this issue Mar 21, 2023 · 6 comments
Closed

Go bindings #351

mudler opened this issue Mar 21, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@mudler
Copy link
Contributor

mudler commented Mar 21, 2023

Hey 👋 , awesome project!

I'd like to help here, I've did the bindings for go to be used as a library. there are of course some adaptations that I had to run into to make it possible. I'm wondering, there are any plans for golang bindings? Generally speaking there seems to be genuine interest into running this as API too antimatter15#86 , which I worked on here: https://github.com/go-skynet/llama-cli .

I'm happy to contribute my work which currently is in https://github.com/go-skynet/llama, I'm playing with this sparely - I've been using this mainly with alpaca, and could manage to run also 13b and 30b models. I'll update it later to the latest changes so it is on pair with master.

@gjmulder gjmulder added the enhancement New feature or request label Mar 21, 2023
@mudler
Copy link
Contributor Author

mudler commented Apr 4, 2023

Alright, a polished version using the new lib interfaces is here: https://github.com/go-skynet/go-llama.cpp/tree/master @ggerganov @gjmulder I'd be more than happy to have it here instead - would make it sense to wrap it up in a PR?

@ggerganov
Copy link
Owner

@mudler
Looks great! If you wish to add it to this project, please see how we organized the Go bindings in the whisper.cpp repo and provide basic CI scripts together with the change.
I am also happy to link to your repo from the README if you this would be easier for you.

@mudler
Copy link
Contributor Author

mudler commented Apr 5, 2023

I'm happy either way to be honest, I think mostly depends if you plan to have the language bindings sitting nearby the llama.cpp codebase. I was planning in any case to add documentation to the bindings.

I think it would best for the bindings to sit next to the project for maintainability, however maybe its worth meanwhile I work on a PR we can add it to the README, what do you think?

I'm checking whisper.cpp and I see it does tests also with the model, which I think we can't do here with llama.cpp as most of weights/models I can find are bind to the LLaMA license, which is not permissive - it prohibits redistribution and modifications (so any variant would be against their license, potentially we could violate DCMA just by referencing links to the model).

What do you suggest here? A simple test that compiles the binding and exercise the lib minimally would be ok?

@mappu
Copy link

mappu commented Apr 8, 2023

I was looking for Go bindings today, but in the go-skynet version, the llama_predict wrapper function was too high level for what I wanted. If it helps at all for reference, I've also done a basic Go app using the llama.h functions directly - https://git.ivysaur.me/code.ivysaur.me/llamacpphtmld although there's no useful binding abstraction at all.

@mudler
Copy link
Contributor Author

mudler commented Apr 8, 2023

I was looking for Go bindings today, but in the go-skynet version, the llama_predict wrapper function was too high level for what I wanted. If it helps at all for reference, I've also done a basic Go app using the llama.h functions directly - https://git.ivysaur.me/code.ivysaur.me/llamacpphtmld although there's no useful binding abstraction at all.

good food for thoughts, I was thinking too to expose a lower level API for granular control in go as well aside a higher level one, maybe we can join forces and do it together, WDYT?

@matthewrennie
Copy link

matthewrennie commented Apr 11, 2023

Very high level, but I thought I would leave this here anyway: https://github.com/matthewrennie/go-llama.cpp

Deadsg pushed a commit to Deadsg/llama.cpp that referenced this issue Dec 19, 2023
…bias-parameter

Add support for `logit_bias` and `logit_bias_type` parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants