File size: 2,067 Bytes
980f806
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
language:
- en
license: apache-2.0
base_model: codellama/CodeLlama-7b-hf
tags:
- code
- python
- codellama
- qlora
- unsloth
datasets:
- custom
pipeline_tag: text-generation
---

# CodeLlama 7B Python AI Assistant (QLoRA)

Fine-tuned CodeLlama-7B model specialized for Python programming assistance using QLoRA (Quantized Low-Rank Adaptation).

## Model Description

- **Base Model:** [codellama/CodeLlama-7b-hf](https://huggingface.co/codellama/CodeLlama-7b-hf)
- **Fine-tuning Method:** QLoRA (4-bit quantization with LoRA adapters)
- **Framework:** Unsloth + Transformers
- **Training Data:** Custom Python programming examples

## Usage

This repository contains **LoRA adapters only**. To use, merge the adapters with the base model.

from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
model_name="pranav-pvnn/codellama-7b-python-ai-assistant",
max_seq_length=2048,
load_in_4bit=True,
)

prompt = "### Instruction:\nWrite a Python function to calculate factorial.\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs, skip_special_tokens=True))

## Training Details

- **Quantization:** 4-bit
- **LoRA Rank:** 64
- **Learning Rate:** 2e-4
- **Epochs:** 4
- **Max Seq Length:** 2048
- **GPU:** NVIDIA Tesla T4

## Limitations

- Requires base model for inference.
- Optimized for Python code generation.
- Trained on custom dataset (~2,000 examples).

## Citation

@misc{codellama-7b-python-assistant,
author = {pranav-pvnn},
title = {CodeLlama 7B Python AI Assistant},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/pranav-pvnn/codellama-7b-python-ai-assistant}}
}

## Acknowledgements

- Base Model: [Meta's CodeLlama](https://huggingface.co/codellama/CodeLlama-7b-hf)
- Training Framework: [Unsloth](https://github.com/unslothai/unsloth)
- Quantization: [bitsandbytes](https://github.com/TimDettmers/bitsandbytes)
- LoRA: [PEFT](https://github.com/huggingface/peft)