YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
LLaMA 3.2 3B β Python Code Generation (QLoRA Fine-tune)
Model Description
Fine-tuned LLaMA 3.2 3B on Python code generation using QLoRA (4-bit NF4 quantization).
Trained on iamtarun/python_code_instructions_18k_alpaca β 18k Python instruction-output pairs.
Training Details
- Base model: meta-llama/Llama-3.2-3B
- Method: QLoRA (LoRA rank=16, alpha=32, 4-bit NF4 quantization)
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Dataset: 16,738 training samples, 1,862 test samples
- Epochs: 3
- Batch size: 2 Γ 8 gradient accumulation = 16 effective
- Learning rate: 2e-4 with linear scheduler
- Optimizer: AdamW 8-bit
- Hardware: Single NVIDIA T4 (16GB)
- Training time: ~3.6 hours
- Final training loss: 0.573
Loss Curve
| Epoch | Loss |
|---|---|
| 1 | ~0.65 |
| 2 | ~0.47 |
| 3 | 0.57 |
Usage
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
"reddyrohith49471/llama3.2-3b-python-qlora",
max_seq_length=2048,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
inputs = tokenizer(
"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n"
"Write a Python function to check if a number is prime."
"<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
return_tensors="pt"
).to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Framework
- Unsloth 2x faster fine-tuning
- HuggingFace PEFT + TRL
- PyTorch + bitsandbytes
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support