Fine-tuning Qwen 2.5 3B with QLoRA on UltraChat using Transformers, PEFT, and Hugging Face.
2
stars
32
commits
Python
primary language
Aug 16, 2026
updated
A lightweight but production-ready fine-tuning workflow for the Qwen 2.5 3B Instruct model using QLoRA, UltraChat data cleaning, and Hugging Face Hub checkpoint publishing.
This project takes a clean, instruction-tuned conversational dataset, filters out noisy examples, and trains a compact adapter for better local generation quality without fully fine-tuning the base model.
LLM/
├── README.md
├── LICENSE
├── requirements.txt
├── requirements-kaggle.txt
├── .gitignore
├── .env.example
├── data/
│ ├── processed/
│ ├── train/
│ ├── train_clean/
│ ├── validation/
│ └── validation_clean/
│
├── model/
│ ├── adapters/
│ └── checkpoints/
├── outputs/
│ └── qwen-3b-qlora/
├── scripts/
│ ├── clean_data.py
│ ├── prepare_data.py
│ ├── test_gpu.py
│ └── test_model.py
├── src/
│ ├── dataset.py
│ ├── evaluate.py
│ ├── inference.py
│ └── train.py
├── docs/
│ └── PROJECT_GUIDE.md
python -m venv .venv
source .venv/bin/activate
On Windows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python scripts/prepare_data.py
python scripts/clean_data.py
This creates the filtered dataset under data/processed for training and validation.
python src/train.py
This script:
python src/inference.py
This compares the base model and the fine-tuned adapter on sample prompts.
The project uses a tuned QLoRA setup in src/train.py:
Qwen/Qwen2.5-3B-Instruct102416320.052e-414-bit NF4paged_adamw_8bitThe cleaning pipeline in scripts/clean_data.py filters conversations based on:
This keeps the final dataset focused on high-quality chat examples rather than noisy raw conversations.
Before pushing checkpoints, authenticate with Hugging Face:
huggingface-cli login
The training script expects a model repo such as:
llm-lab-dz/qwen-3b-qlora-ultrachat
If you want to change the repository, edit the HF_REPO_ID constant inside src/train.py.
If you run this project in Kaggle, remember that input folders are often read-only. Keep your outputs under /kaggle/working and write checkpoints there instead of to the read-only dataset folders.
Useful helper scripts:
This project is licensed under the MIT License. See LICENSE for details.
Built for efficient, modern LLM fine-tuning and clean experimentation.
18 commits
14 commits
Python
100.0%
Fine-tuning Qwen 2.5 3B with QLoRA on UltraChat using Transformers, PEFT, and Hugging Face.
2
stars
32
commits
Python
primary language
Aug 16, 2026
updated
A lightweight but production-ready fine-tuning workflow for the Qwen 2.5 3B Instruct model using QLoRA, UltraChat data cleaning, and Hugging Face Hub checkpoint publishing.
This project takes a clean, instruction-tuned conversational dataset, filters out noisy examples, and trains a compact adapter for better local generation quality without fully fine-tuning the base model.
LLM/
├── README.md
├── LICENSE
├── requirements.txt
├── requirements-kaggle.txt
├── .gitignore
├── .env.example
├── data/
│ ├── processed/
│ ├── train/
│ ├── train_clean/
│ ├── validation/
│ └── validation_clean/
│
├── model/
│ ├── adapters/
│ └── checkpoints/
├── outputs/
│ └── qwen-3b-qlora/
├── scripts/
│ ├── clean_data.py
│ ├── prepare_data.py
│ ├── test_gpu.py
│ └── test_model.py
├── src/
│ ├── dataset.py
│ ├── evaluate.py
│ ├── inference.py
│ └── train.py
├── docs/
│ └── PROJECT_GUIDE.md
python -m venv .venv
source .venv/bin/activate
On Windows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python scripts/prepare_data.py
python scripts/clean_data.py
This creates the filtered dataset under data/processed for training and validation.
python src/train.py
This script:
python src/inference.py
This compares the base model and the fine-tuned adapter on sample prompts.
The project uses a tuned QLoRA setup in src/train.py:
Qwen/Qwen2.5-3B-Instruct102416320.052e-414-bit NF4paged_adamw_8bitThe cleaning pipeline in scripts/clean_data.py filters conversations based on:
This keeps the final dataset focused on high-quality chat examples rather than noisy raw conversations.
Before pushing checkpoints, authenticate with Hugging Face:
huggingface-cli login
The training script expects a model repo such as:
llm-lab-dz/qwen-3b-qlora-ultrachat
If you want to change the repository, edit the HF_REPO_ID constant inside src/train.py.
If you run this project in Kaggle, remember that input folders are often read-only. Keep your outputs under /kaggle/working and write checkpoints there instead of to the read-only dataset folders.
Useful helper scripts:
This project is licensed under the MIT License. See LICENSE for details.
Built for efficient, modern LLM fine-tuning and clean experimentation.
18 commits
14 commits
Python
100.0%