TinyLlama LoRA Fine-Tuning

This repository contains a LoRA adapter fine-tuned on the Alpaca instruction dataset using PEFT and TRL.

Base Model

  • TinyLlama/TinyLlama-1.1B-Chat-v1.0

Training Details

  • Framework: Hugging Face Transformers
  • PEFT Method: LoRA
  • Trainer: TRL SFTTrainer
  • Dataset: tatsu-lab/alpaca
  • Epochs: 1
  • LoRA Rank (r): 8
  • LoRA Alpha: 16
  • LoRA Dropout: 0.05
  • Target Modules:
    • q_proj
    • v_proj

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

tokenizer = AutoTokenizer.from_pretrained(
    "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
)

base_model = AutoModelForCausalLM.from_pretrained(
    "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
)

model = PeftModel.from_pretrained(
    base_model,
    "Rupa421/TinyLlama-LoRA"
)

Example Prompt

### Instruction:
Explain what LoRA is.

### Response:

Project Goal

This project was built to demonstrate an end-to-end parameter-efficient fine-tuning (PEFT) workflow using:

  • Hugging Face Transformers
  • PEFT (LoRA)
  • TRL SFTTrainer
  • TinyLlama

The project covers dataset formatting, prompt engineering, LoRA configuration, supervised fine-tuning, inference, and publishing the trained adapter to Hugging Face.

Author

Built with ❤️ while learning PyTorch Internals and Transformer Architecture.

Downloads last month
41
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Rupa421/TinyLlama-LoRA

Adapter
(1574)
this model