real-llama-cpp-python
A simple custom wrapper for llama.cpp models in Python, support seamlessly interaction with LangChain. As the name suggests, it is truly a wrapper for llama.cpp, you should have installed llama.cpp into your machine prior to this.
Background
While it might seem intuitive that llama-cpp-python would seamlessly integrate with llama.cpp, the reality is that installing llama-cpp-python is a pain in the bum. It is NOT simple as described pip install llama-cpp-python.
Langchain, by default, supports llama-cpp-python. If you have a pipeline that works with Langchain, it would be very difficult to run the latest quantized model (gguf files downloaded from HuggingFace) from llama.cpp. The real-llama-cpp-python is a simplified and an alternative library designed to seamlessly integrate with LangChain while avoiding the pain of installing the library llama-cpp-python.
llama.cpp can be installed or built easily. (If you are facing the challenge by the time you install llama.cpp, the llama.cpp community is also very active that any issue can be resolved in a few days (unlike llama-cpp-python).
Installation
As the name said, it is truly a wrapper for llama.cpp, you should first install llama.cpp into your machine.
1 Install llama.cpp first
- Highly recommend this method Clone llama.cpp repository and build locally, see how to build
- On MacOS or Linux, install
llama.cppvia brew, flox or nix. Noted that, this brew install may not support GPU. - Use a
llama.cppDocker image, see documentation for Docker. - Have not tested yet Download pre-built binaries from releases.
After successfully built/installed llama.cpp. You want to add llama.cpp directory to your PATH permanently by editing your shell configuration file:
vim ~/.bashrc
or
source ~/.zshrc
Add the following line:
export PATH=$PATH:/path/to/your/llama.cpp/build/bin
Save and run source ~/.bashrc or source ~/.zshrc
You should be able to run llama-cli and llama-server from any directory. Verify the accessibility, run the following commands in any directory
llama-cli --help
llama-server --help
2 Install llama.cpp
Now, you can install real-llama-cpp-python by either install the stable version through pip install
pip install real-llama-cpp-python
or clone the github repository for the developing features.
git clone https://github.com/minhtran1309/real-llama-cpp-python.git
cd real-llama-cpp-python
pip install -e .
3 Running the tests
Metadata
Release files for real-llama-cpp-python 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| real_llama_cpp_python-0.1.6.tar.gz | 17.6 kB | Without provenance | Details for real_llama_cpp_python-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| real_llama_cpp_python-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for real_llama_cpp_python-0.1.6-py3-none-any.whl |
Total release size: 26.1 kB
Release files / real_llama_cpp_python-0.1.6.tar.gz
| Download URL | real_llama_cpp_python-0.1.6.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
051b6c741639f43cf6f27c150512f6cae94227ec43ce22d29165e21300be21cb
|
|
BLAKE2b-256 checksum How to use checksums |
fa661c874d32fbd8ecf8f36888996b7f691e22ef45c75a55ab8900894c46eeba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.2
|
Release files / real_llama_cpp_python-0.1.6-py3-none-any.whl
| Download URL | real_llama_cpp_python-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0097ad2056ea3e23178fa6b9b2d697717c5b7096bfda31d443e5dbce484dc63
|
|
BLAKE2b-256 checksum How to use checksums |
6328ea65403cfb02b66463e51421fefae69323fc995e1580f897564d9dac2356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.2
|
Security for real-llama-cpp-python 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.