Instructions to use banty1614/codeforge-qwen-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use banty1614/codeforge-qwen-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-3B-Instruct") model = PeftModel.from_pretrained(base_model, "banty1614/codeforge-qwen-lora") - Transformers
How to use banty1614/codeforge-qwen-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="banty1614/codeforge-qwen-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("banty1614/codeforge-qwen-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use banty1614/codeforge-qwen-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "banty1614/codeforge-qwen-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "banty1614/codeforge-qwen-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/banty1614/codeforge-qwen-lora
- SGLang
How to use banty1614/codeforge-qwen-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "banty1614/codeforge-qwen-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "banty1614/codeforge-qwen-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "banty1614/codeforge-qwen-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "banty1614/codeforge-qwen-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use banty1614/codeforge-qwen-lora with Docker Model Runner:
docker model run hf.co/banty1614/codeforge-qwen-lora
π CodeForge AI
Fine-tuned Qwen2.5-3B-Instruct using QLoRA + PEFT for software engineering tasks.
π CodeForge AI
A QLoRA fine-tuned version of Qwen2.5-3B-Instruct for software engineering and Python coding tasks.
π Overview
CodeForge AI is a parameter-efficient fine-tuned (PEFT) Large Language Model built on Qwen2.5-3B-Instruct.
The objective of this project is to demonstrate a complete end-to-end modern LLM fine-tuning workflow using:
- QLoRA
- LoRA
- PEFT
- Hugging Face Transformers
- TRL SFTTrainer
- Google Colab Tesla T4
Instead of updating all 3.1 billion parameters, only 0.96% of the parameters were trained, making the project lightweight and GPU-efficient.
π Base Model
Model
Qwen/Qwen2.5-3B-Instruct
β‘ Fine-Tuning Technique
- QLoRA (4-bit Quantization)
- LoRA (Low-Rank Adaptation)
- PEFT (Parameter Efficient Fine Tuning)
- Supervised Fine-Tuning (SFT)
π Dataset
Dataset used:
iamtarun/python_code_instructions_18k_alpaca
Dataset contains approximately 18,000 Python instruction-following examples.
For this proof-of-concept training run, a subset of the dataset was used.
β Training Configuration
| Parameter | Value |
|---|---|
| Base Model | Qwen2.5-3B-Instruct |
| Fine-Tuning | QLoRA |
| LoRA Rank (r) | 16 |
| Alpha | 32 |
| Dropout | 0.05 |
| Quantization | 4-bit NF4 |
| Optimizer | AdamW |
| Learning Rate | 2e-4 |
| Max Steps | 100 |
| Batch Size | 2 |
| Gradient Accumulation | 4 |
| Max Sequence Length | 512 |
| GPU | Tesla T4 (16 GB) |
π Training Results
Training completed successfully.
Final Training Loss:
0.7047
Trainable Parameters:
29,933,568
Total Parameters:
3,115,872,256
Percentage of Trainable Parameters:
0.9607%
π§ Architecture
Python Instruction Dataset
β
βΌ
Tokenization
β
βΌ
Qwen2.5-3B-Instruct
β
βΌ
4-bit Quantization
β
βΌ
QLoRA
β
βΌ
LoRA Adapters
β
βΌ
Supervised Fine-Tuning
β
βΌ
Fine-Tuned Adapter
β
βΌ
Hugging Face Hub
π» Usage
from transformers import AutoTokenizer
from peft import AutoPeftModelForCausalLM
model = AutoPeftModelForCausalLM.from_pretrained(
"banty1614/codeforge-qwen-lora",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(
"banty1614/codeforge-qwen-lora"
)
Example:
messages = [
{
"role": "user",
"content": "Write a Python function to reverse a linked list."
}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
π Evaluation
The model was compared with the original base model on multiple Python programming prompts.
Evaluation included:
- Code correctness
- Explanation quality
- Readability
- Response formatting
This project demonstrates the complete QLoRA fine-tuning workflow rather than claiming to outperform the original Qwen model across all programming tasks.
β Limitations
- Trained for only 100 optimization steps.
- Uses a subset of the original dataset.
- Intended as a proof-of-concept for parameter-efficient fine-tuning.
- Not evaluated on standardized coding benchmarks.
π Future Work
- Train on the complete dataset.
- Increase training epochs.
- Add evaluation on HumanEval and MBPP.
- Expand training to FastAPI, SQL, Docker, Git, and System Design.
- Support multiple LoRA adapters for different software engineering domains.
π Acknowledgements
- Alibaba Cloud for Qwen2.5
- Hugging Face
- TRL
- PEFT
- BitsAndBytes
- Google Colab
If you use this project for learning or research, please consider giving the repository a β.
- Downloads last month
- 65
Model tree for banty1614/codeforge-qwen-lora
Dataset used to train banty1614/codeforge-qwen-lora
Evaluation results
- Training Lossself-reported0.705