Skip to content

Shubhamx404/FINETUNELLM

Repository files navigation

FINE TUNE LAMMA USING QLORA

🦙 Fine-Tuning LLaMA-2-7B with QLoRA on Google Colab

This repository demonstrates how to fine-tune Meta’s LLaMA-2-7B model efficiently using QLoRA and PEFT on a single Google Colab GPU.
It turns the base model into a custom instruction-following chatbot trained on the Indian Constitution Articles dataset.


Check more models on Hugging Face

📘 Dataset

  • Name: nisaar/Articles_Constitution_3300_Instruction_Set
  • Source: Hugging Face Datasets
  • Description:
    Instruction-based dataset derived from the Indian Constitution, containing ~3300 examples.
    Each sample includes:
    {
      "instruction": "Explain Article 21 of the Indian Constitution.",
      "input": "",
      "output": "Article 21 guarantees the protection of life and personal liberty..."
    }
    

!pip install -q transformers accelerate bitsandbytes peft trl datasets einops 🧠 Model & Approach

  • Base Model: meta-llama/Llama-2-7b-hf

  • Quantization: 4-bit (using bitsandbytes)

  • Finetuning Strategy: QLoRA (Quantized Low-Rank Adaptation)

  • Trainer: SFTTrainer from trl

Key benefits:

  • Runs on a single GPU (Colab T4 / A100)

  • Significantly reduced VRAM usage

  • Compatible with PEFT for adapter-based fine-tuning

Saving model : trainer.model.save_pretrained("Llama2-7b-constitution-qlora") tokenizer.save_pretrained("Llama2-7b-constitution-qlora")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors