Odin bindings to the Llama.cpp
At the moment functionality in the binding.odin is enough to run simple example based on llama.cpp/examples/simple example.
- Clone Llama.cpp and checkout to the b3735 tag:
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
git checkout b3735- [Optional] Build libraries and binaries. This allows you to test build with chosen build flags.
# assume you're in the llama.cpp dir
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DGGML_CUDA=ON ..
cmake --build . --config Release --parallel 8- Download model you want into the models folder:
# assume you're in the project root dir
make get-gemma2b- [Optional] Test downloaded model with
llama-cliyou've built on the step (2)
./llama.cpp/build/bin/llama-cli --model models/gemma-2b.Q2_K.gguf --prompt "Once upon a time" --predict 128- Build and run simple example
# assume you're in the project root dir
make example-simpleThis will apply Makefile.patch to the llama.cpp/Makefile, copy binding.cpp and binding.h to the llama.cpp/ folder, and build binding.a file.
Then, simple project will be compiled and linked with binding.a.
- This is a "thin" wrapper, no custom functionality is added.
- All command line arguments are directly passed to the llama.cpp for parsing.
- Opaque pointers has
_ptrpostfix. - Wrapped functions has
lpp_prefix (short of llama.cpp). Those are usually form common.h. - Functions without
lpp_prefix are from llama.h
Here: https://github.com/ggerganov/llama.cpp/tree/b3735/
To extend current functionality, please refere to the following: