qwen2.5-coder-3b-unsloth-lora
This repository contains a LoRA adapter, not a full standalone model.
It was created by fine-tuning unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit for coding-assistance behavior on Google Colab using T4 GPU.
What This Model Is
This adapter is the first-stage coding-focused fine-tune in the project.
Training goal:
- improve structured coding responses
- improve instruction-following for programming tasks
- improve simple bug-fixing behavior
This adapter should be loaded on top of the base model:
- base model:
unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit
Dataset
This adapter was trained on a sampled subset of:
bigcode/self-oss-instruct-sc2-exec-filter-50k
Project training setup:
- sampled rows before filtering:
4000 - rows used after filtering:
3993 - max sequence length:
1024 - training steps:
250
Training Summary
This model was trained with supervised fine-tuning (SFT) using LoRA and 4-bit quantization.
Key setup:
- LoRA rank:
16 - LoRA alpha:
16 - LoRA dropout:
0 - batch size per device:
1 - gradient accumulation:
16 - learning rate:
1e-4 - optimizer:
adamw_8bit - hardware: Google Colab
Tesla T4
Observed result:
- final training loss: about
0.6130
Intended Use
Use this adapter when you want:
- a lightweight coding assistant
- better structured code answers
- simple debugging help
- a PEFT adapter that runs on top of the Qwen2.5-Coder 3B base model
Limitations
This adapter is not a standalone merged model.
It also was not the strongest model in the later direct-answer benchmark on every prompt. It improved some focused coding-task behavior, but it should be understood as a practical low-resource experiment rather than a universally superior model.
How To Load
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
BASE_MODEL = "Qwen/Qwen2.5-Coder-3B-Instruct"
ADAPTER_MODEL = "M-Alkassem/qwen2.5-coder-3b-unsloth-lora"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, use_fast=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
quantization_config=bnb_config,
torch_dtype=torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, ADAPTER_MODEL)
model.eval()
Example Prompt
prompt = "Debug this Python code and explain the bug: def is_even(n): return n % 2 == 1"
Project Context This adapter is part of a larger two-stage project:
coding-focused adapter: this repository agent-oriented continued adapter: M-Alkassem/qwen2.5-coder-3b-agent-v1 The later agent adapter was trained by continuing from this coding adapter.
References
- Qwen2.5-Coder base model: https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct
- Unsloth quantized base: https://huggingface.co/unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit
- Dataset card: https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k
- Downloads last month
- 56