Downloads · 30 days
0
nileshkendre/llama2-7b-qlora-sft
llama2-7b-qlora-sft is a text generation model from nileshkendre. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama2.
This repository contains a Parameter-Efficient Fine-Tuned (PEFT) version of the Llama-2-7B Chat model using the QLoRA approach. The model was instruction-tuned using the Guanaco LLaMA2 1K dataset with the Hugging Face…
Downloads · 30 days
0
Access
Public
Updated Jul 28, 2026
Repo size
134 MB
Likes
1
Public
Click a slice to open those files.
.safetensors134 MB · 100%
From the Hugging Face model README
This repository contains a Parameter-Efficient Fine-Tuned (PEFT) version of the Llama-2-7B Chat model using the QLoRA approach. The model was instruction-tuned using the Guanaco LLaMA2 1K dataset with the Hugging Face TRL SFTTrainer.
The objective of this project was to understand and implement an end-to-end Large Language Model (LLM) fine-tuning workflow using modern open-source tools, including Transformers, PEFT, BitsAndBytes, and TRL.
| Item | Value |
|---|---|
| Base Model | NousResearch/Llama-2-7b-chat-hf |
| Fine-Tuning Method | PEFT |
| Technique | QLoRA |
| Training Method | Supervised Fine-Tuning (SFT) |
| Framework | Hugging Face Transformers |
| Trainer | TRL SFTTrainer |
| Quantization | 4-bit |
| Dataset | mlabonne/guanaco-llama2-1k |
This model was fine-tuned using the mlabonne/guanaco-llama2-1k instruction dataset available on Hugging Face.
The dataset contains approximately 1,000 instruction-response pairs covering a wide range of tasks, including:
The dataset is designed for supervised instruction tuning of chat-based Large Language Models.
The complete training workflow consisted of the following stages:
| Parameter | Value |
|---|---|
| Epochs | 1 |
| Batch Size | 1 |
| Gradient Accumulation Steps | 2 |
| Learning Rate | 2e-4 |
| Optimizer | paged_adamw_32bit |
| Weight Decay | 0.001 |
| Max Gradient Norm | 0.3 |
| Warmup Ratio | 0.03 |
| Quantization | 4-bit |
| LoRA Rank (r) | 64 |
| LoRA Dropout | 0.1 |
Parameter-Efficient Fine-Tuning (PEFT) enables efficient adaptation of Large Language Models by training only a small set of additional parameters instead of updating the entire model. This significantly reduces GPU memory consumption, training time, and storage requirements while maintaining competitive performance.
QLoRA combines Low-Rank Adaptation (LoRA) with 4-bit quantization using the BitsAndBytes library. By loading the frozen base model in 4-bit precision and training only the LoRA adapter weights, QLoRA enables fine-tuning of billion-parameter language models on limited GPU resources.
adapter_config.json
adapter_model.safetensors
README.md
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"NousResearch/Llama-2-7b-chat-hf"
)
tokenizer = AutoTokenizer.from_pretrained(
"NousResearch/Llama-2-7b-chat-hf"
)
model = PeftModel.from_pretrained(
base_model,
"nileshkendre/llama2-7b-qlora-sft"
)
This repository contains only the LoRA adapter weights and not the original Llama-2-7B base model.
The model was fine-tuned on the public mlabonne/guanaco-llama2-1k instruction dataset containing approximately 1,000 instruction-response pairs. It is intended to demonstrate the end-to-end PEFT/QLoRA fine-tuning workflow and should be considered an educational portfolio project rather than a production-ready conversational assistant.
Additional fine-tuning, evaluation, and safety testing would be required before deploying it in production.
Future enhancements include:
Nilesh Kendre
AI Engineer | Generative AI | LLMs | NLP | RAG | Agentic AI
This repository showcases hands-on implementation of PEFT, QLoRA, and Supervised Fine-Tuning (SFT) using the Hugging Face ecosystem.