Instructions to use pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf", filename="codellama-7b-merged-Q4_K_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf pranav-pvnn/codellama-7b-python-ai-assistant-full-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 pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf pranav-pvnn/codellama-7b-python-ai-assistant-full-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 pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf pranav-pvnn/codellama-7b-python-ai-assistant-full-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 pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M
Use Docker
docker model run hf.co/pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf with Ollama:
ollama run hf.co/pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M
- Unsloth Studio
How to use pranav-pvnn/codellama-7b-python-ai-assistant-full-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 pranav-pvnn/codellama-7b-python-ai-assistant-full-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 pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf to start chatting
- Docker Model Runner
How to use pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf with Docker Model Runner:
docker model run hf.co/pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M
- Lemonade
How to use pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull pranav-pvnn/codellama-7b-python-ai-assistant-full-gguf:Q4_K_M
Run and chat with the model
lemonade run user.codellama-7b-python-ai-assistant-full-gguf-Q4_K_M
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama2
|
| 3 |
+
base_model: codellama/CodeLlama-7b-hf
|
| 4 |
+
tags:
|
| 5 |
+
- code
|
| 6 |
+
- llama
|
| 7 |
+
- gguf
|
| 8 |
+
- merged
|
| 9 |
+
- python
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# CodeLlama 7B Python AI Assistant (Merged GGUF)
|
| 13 |
+
|
| 14 |
+
This is a merged version of the QLoRA fine-tuned CodeLlama-7B model. The LoRA weights have been merged with the base model and converted to GGUF format for easy deployment.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
|
| 18 |
+
- **Base Model**: CodeLlama-7b-hf
|
| 19 |
+
- **Original LoRA Adapter**: pranav-pvnn/codellama-7b-python-ai-assistant
|
| 20 |
+
- **Fine-tuning Method**: QLoRA (4-bit quantization with LoRA)
|
| 21 |
+
- **Format**: GGUF (self-contained, no separate adapter needed)
|
| 22 |
+
- **Training Framework**: Unsloth
|
| 23 |
+
|
| 24 |
+
## Available Quantizations
|
| 25 |
+
|
| 26 |
+
- `codellama-7b-merged-f16.gguf` - Full precision (FP16) - ~13 GB
|
| 27 |
+
- `codellama-7b-merged-Q4_K_M.gguf` - 4-bit quantization (recommended) - ~4 GB
|
| 28 |
+
- `codellama-7b-merged-Q5_K_M.gguf` - 5-bit quantization (higher quality) - ~5 GB
|
| 29 |
+
- `codellama-7b-merged-Q8_0.gguf` - 8-bit quantization (highest quality) - ~7 GB
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
### With llama.cpp:
|
| 34 |
+
```bash
|
| 35 |
+
./llama-cli -m codellama-7b-merged-Q4_K_M.gguf -p "### Instruction:\nWrite a Python function to calculate factorial.\n### Response:\n"
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
### With Python (llama-cpp-python):
|
| 39 |
+
```python
|
| 40 |
+
from llama_cpp import Llama
|
| 41 |
+
|
| 42 |
+
llm = Llama(model_path="codellama-7b-merged-Q4_K_M.gguf")
|
| 43 |
+
prompt = "### Instruction:\nWrite a Python function to calculate factorial.\n### Response:\n"
|
| 44 |
+
output = llm(prompt, max_tokens=256)
|
| 45 |
+
print(output['choices'][0]['text'])
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### With Ollama:
|
| 49 |
+
1. Create a Modelfile:
|
| 50 |
+
```
|
| 51 |
+
FROM ./codellama-7b-merged-Q4_K_M.gguf
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
2. Create the model:
|
| 55 |
+
```bash
|
| 56 |
+
ollama create my-codellama -f Modelfile
|
| 57 |
+
ollama run my-codellama "Write a Python function to sort a list"
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Training Details
|
| 61 |
+
|
| 62 |
+
- **Quantization**: 4-bit QLoRA
|
| 63 |
+
- **LoRA Rank**: 64
|
| 64 |
+
- **Learning Rate**: 2e-4
|
| 65 |
+
- **Epochs**: 4
|
| 66 |
+
- **Max Seq Length**: 2048
|
| 67 |
+
- **Training Data**: Custom Python programming examples (~2,000 examples)
|
| 68 |
+
- **GPU**: NVIDIA Tesla T4
|
| 69 |
+
|
| 70 |
+
## Prompt Format
|
| 71 |
+
|
| 72 |
+
```
|
| 73 |
+
### Instruction:
|
| 74 |
+
[Your instruction here]
|
| 75 |
+
### Response:
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## License
|
| 79 |
+
|
| 80 |
+
Same as base model (Llama 2 license)
|
| 81 |
+
|
| 82 |
+
## Acknowledgements
|
| 83 |
+
|
| 84 |
+
- Base Model: [Meta's CodeLlama](https://huggingface.co/codellama/CodeLlama-7b-hf)
|
| 85 |
+
- Training Framework: [Unsloth](https://github.com/unslothai/unsloth)
|