Instructions to use TheBloke/CodeLlama-7B-Python-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/CodeLlama-7B-Python-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/CodeLlama-7B-Python-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TheBloke/CodeLlama-7B-Python-GGUF", dtype="auto") - llama-cpp-python
How to use TheBloke/CodeLlama-7B-Python-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="TheBloke/CodeLlama-7B-Python-GGUF", filename="codellama-7b-python.Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use TheBloke/CodeLlama-7B-Python-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
Use Docker
docker model run hf.co/TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use TheBloke/CodeLlama-7B-Python-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/CodeLlama-7B-Python-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/CodeLlama-7B-Python-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
- SGLang
How to use TheBloke/CodeLlama-7B-Python-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TheBloke/CodeLlama-7B-Python-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/CodeLlama-7B-Python-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TheBloke/CodeLlama-7B-Python-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/CodeLlama-7B-Python-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use TheBloke/CodeLlama-7B-Python-GGUF with Ollama:
ollama run hf.co/TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
- Unsloth Studio new
How to use TheBloke/CodeLlama-7B-Python-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TheBloke/CodeLlama-7B-Python-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TheBloke/CodeLlama-7B-Python-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for TheBloke/CodeLlama-7B-Python-GGUF to start chatting
- Docker Model Runner
How to use TheBloke/CodeLlama-7B-Python-GGUF with Docker Model Runner:
docker model run hf.co/TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
- Lemonade
How to use TheBloke/CodeLlama-7B-Python-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull TheBloke/CodeLlama-7B-Python-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.CodeLlama-7B-Python-GGUF-Q4_K_M
List all available models
lemonade list
Initial GGUF model commit
Browse files
README.md
CHANGED
|
@@ -45,15 +45,15 @@ The key benefit of GGUF is that it is a extensible, future-proof format which st
|
|
| 45 |
|
| 46 |
As of August 25th, here is a list of clients and libraries that are known to support GGUF:
|
| 47 |
* [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
|
|
|
| 48 |
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), now supports GGUF as of release 1.41! A powerful GGML web UI, with full GPU accel. Especially good for story telling.
|
| 49 |
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), should now work, choose the `c_transformers` backend. A great web UI with many interesting features. Supports CUDA GPU acceleration.
|
| 50 |
* [ctransformers](https://github.com/marella/ctransformers), now supports GGUF as of version 0.2.24! A Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
|
|
|
|
| 51 |
* [candle](https://github.com/huggingface/candle), added GGUF support on August 22nd. Candle is a Rust ML framework with a focus on performance, including GPU support, and ease of use.
|
| 52 |
|
| 53 |
-
The clients and libraries below are expecting to add GGUF support
|
| 54 |
-
* [
|
| 55 |
-
* [LM Studio](https://lmstudio.ai/), in active development - hoped to be ready by August 25th-26th.
|
| 56 |
-
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), [in active development](https://github.com/abetlen/llama-cpp-python/issues/628).
|
| 57 |
<!-- README_GGUF.md-about-gguf end -->
|
| 58 |
|
| 59 |
<!-- repositories-available start -->
|
|
@@ -66,10 +66,12 @@ The clients and libraries below are expecting to add GGUF support. Where possibl
|
|
| 66 |
<!-- repositories-available end -->
|
| 67 |
|
| 68 |
<!-- prompt-template start -->
|
| 69 |
-
## Prompt template:
|
| 70 |
|
| 71 |
```
|
| 72 |
-
|
|
|
|
|
|
|
| 73 |
```
|
| 74 |
|
| 75 |
<!-- prompt-template end -->
|
|
@@ -164,7 +166,7 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
|
|
| 164 |
|
| 165 |
**Special thanks to**: Aemon Algiz.
|
| 166 |
|
| 167 |
-
**Patreon special mentions**:
|
| 168 |
|
| 169 |
|
| 170 |
Thank you to all my generous patrons and donaters!
|
|
|
|
| 45 |
|
| 46 |
As of August 25th, here is a list of clients and libraries that are known to support GGUF:
|
| 47 |
* [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
| 48 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI. Supports GGUF with GPU acceleration via the ctransformers backend - llama-cpp-python backend should work soon too.
|
| 49 |
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), now supports GGUF as of release 1.41! A powerful GGML web UI, with full GPU accel. Especially good for story telling.
|
| 50 |
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), should now work, choose the `c_transformers` backend. A great web UI with many interesting features. Supports CUDA GPU acceleration.
|
| 51 |
* [ctransformers](https://github.com/marella/ctransformers), now supports GGUF as of version 0.2.24! A Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
|
| 52 |
+
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), supports GGUF as of version 0.1.79. A Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
|
| 53 |
* [candle](https://github.com/huggingface/candle), added GGUF support on August 22nd. Candle is a Rust ML framework with a focus on performance, including GPU support, and ease of use.
|
| 54 |
|
| 55 |
+
The clients and libraries below are expecting to add GGUF support shortly:
|
| 56 |
+
* [LM Studio](https://lmstudio.ai/), should be updated by end August 25th.
|
|
|
|
|
|
|
| 57 |
<!-- README_GGUF.md-about-gguf end -->
|
| 58 |
|
| 59 |
<!-- repositories-available start -->
|
|
|
|
| 66 |
<!-- repositories-available end -->
|
| 67 |
|
| 68 |
<!-- prompt-template start -->
|
| 69 |
+
## Prompt template: CodeLlama
|
| 70 |
|
| 71 |
```
|
| 72 |
+
[INST] Write code to solve the following coding problem that obeys the constraints and passes the example test cases. Please wrap your code answer using ```:
|
| 73 |
+
{prompt}
|
| 74 |
+
[/INST]
|
| 75 |
```
|
| 76 |
|
| 77 |
<!-- prompt-template end -->
|
|
|
|
| 166 |
|
| 167 |
**Special thanks to**: Aemon Algiz.
|
| 168 |
|
| 169 |
+
**Patreon special mentions**: Kacper Wikieł, knownsqashed, Leonard Tan, Asp the Wyvern, Daniel P. Andersen, Luke Pendergrass, Stanislav Ovsiannikov, RoA, Dave, Ai Maven, Kalila, Will Dee, Imad Khwaja, Nitin Borwankar, Joseph William Delisle, Tony Hughes, Cory Kujawski, Rishabh Srivastava, Russ Johnson, Stephen Murray, Lone Striker, Johann-Peter Hartmann, Elle, J, Deep Realms, SuperWojo, Raven Klaugh, Sebastain Graf, ReadyPlayerEmma, Alps Aficionado, Mano Prime, Derek Yates, Gabriel Puliatti, Mesiah Bishop, Magnesian, Sean Connelly, biorpg, Iucharbius, Olakabola, Fen Risland, Space Cruiser, theTransient, Illia Dulskyi, Thomas Belote, Spencer Kim, Pieter, John Detwiler, Fred von Graf, Michael Davis, Swaroop Kallakuri, subjectnull, Clay Pascal, Subspace Studios, Chris Smitley, Enrico Ros, usrbinkat, Steven Wood, alfie_i, David Ziegler, Willem Michiel, Matthew Berman, Andrey, Pyrater, Jeffrey Morgan, vamX, LangChain4j, Luke @flexchar, Trenton Dambrowitz, Pierre Kircher, Alex, Sam, James Bentley, Edmond Seymore, Eugene Pentland, Pedro Madruga, Rainer Wilmers, Dan Guido, Nathan LeClaire, Spiking Neurons AB, Talal Aujan, zynix, Artur Olbinski, Michael Levine, 阿明, K, John Villwock, Nikolai Manek, Femi Adebogun, senxiiz, Deo Leter, NimbleBox.ai, Viktor Bowallius, Geoffrey Montalvo, Mandus, Ajan Kanaga, ya boyyy, Jonathan Leane, webtim, Brandon Frisco, danny, Alexandros Triantafyllidis, Gabriel Tamborski, Randy H, terasurfer, Vadim, Junyu Yang, Vitor Caleffi, Chadd, transmissions 11
|
| 170 |
|
| 171 |
|
| 172 |
Thank you to all my generous patrons and donaters!
|