Downloads · 30 days
50
0% of all-time downloads
ShahriarFerdoush/llama-3.2-1b-code-instruct
llama-3.2-1b-code-instruct is a text generation model from ShahriarFerdoush. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A lightweight yet powerful code-focused language model fine-tuned from Meta Llama-3.2-1B using QLoRA (4-bit) on the CodeAlpaca-20K dataset. Designed for efficient code generation, reasoning, and problem-solving on lim…
Downloads · 30 days
50
0% of all-time downloads
All-time downloads
78.4K
Public
Parameters
1.2B
6.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.5 GB · 99%
From the Hugging Face model README
A lightweight yet powerful code-focused language model fine-tuned from Meta Llama-3.2-1B using QLoRA (4-bit) on the CodeAlpaca-20K dataset.
Designed for efficient code generation, reasoning, and problem-solving on limited GPU resources.
🚀 Trained on a single Tesla P100 GPU
⚡ Optimized for Kaggle, Colab, and low-VRAM environments
🧩 Ideal for research, education, and rapid prototyping
| Attribute | Value |
|---|---|
| Base Model | meta-llama/Llama-3.2-1B |
| Model Type | Decoder-only causal language model |
| Fine-Tuning Method | QLoRA (4-bit quantization + LoRA) |
| LoRA Rank | 16 |
| Task Domain | Code generation & code reasoning |
| Training Samples | 10,000 |
| Training Time | ~5 hours |
| Hardware | NVIDIA Tesla P100 |
| Precision | 4-bit (NF4) |
| Frameworks | Hugging Face Transformers, PEFT, BitsAndBytes |
A high-quality instruction-tuning dataset derived from the Alpaca format and specialized for coding tasks.
{
"instruction": "Describe the coding task",
"input": "Optional context or input code",
"output": "Expected code solution"
}
Task Types:
This model was fine-tuned using QLoRA, enabling efficient adaptation of large language models on limited hardware.
| Parameter | Value |
|---|---|
| Max Sequence Length | 1024 |
| LoRA Rank (r) | 16 |
| LoRA Alpha | 32 |
| LoRA Dropout | 0.05 |
| Optimizer | AdamW |
| Learning Rate | 2e-4 |
| Batch Size | Small (GPU-constrained) |
| Gradient Accumulation | Enabled |
| Quantization | 4-bit |
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "YOUR_USERNAME/llama-3.2-1b-code-solver"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
load_in_4bit=True
)
prompt = "Write a Python function to check if a number is prime."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
✅ Allowed