Instructions to use prasanna030/gpt2-qlora-summarizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prasanna030/gpt2-qlora-summarizer with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "summarization" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("summarization", model="prasanna030/gpt2-qlora-summarizer")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("prasanna030/gpt2-qlora-summarizer", dtype="auto") - PEFT
How to use prasanna030/gpt2-qlora-summarizer with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
π§ GPT-2 QLoRA Summarizer
π Overview
This model is a fine-tuned version of GPT-2 using QLoRA (Quantized Low-Rank Adaptation) for the task of abstractive text summarization.
The goal of this project is to evaluate parameter-efficient fine-tuning techniques for LLMs under limited computational resources.
π― Model Details
- Developed by: Prasanna Nagarale
- Model type: Causal Language Model (Decoder-only Transformer)
- Base model: GPT-2
- Fine-tuning method: QLoRA (PEFT)
- Task: Text Summarization
- Framework: Hugging Face Transformers + PEFT
- Language: English
βοΈ Training Details
π Dataset
- Dataset Used: CNN/DailyMail
- Contains:
articleβ input texthighlightsβ target summary
π§Ή Preprocessing
- Removed short or invalid samples
- Ensured:
- Article length > 100 characters
- Summary length > 20 characters
- Tokenization with max length = 512
π§ Fine-Tuning Approach
- Used QLoRA for efficient training:
- 4-bit quantization
- LoRA adapters added to transformer layers
- Enabled training on limited GPU resources (Google Colab)
βοΈ Hyperparameters (Approx)
- Max input length: 512
- Max output tokens: 100
- Training samples: ~1000
- Evaluation samples: ~200
- Batch size: small (Colab-friendly)
π Evaluation
π Metrics Used
- ROUGE-1, ROUGE-2, ROUGE-L
- Used to evaluate summary quality
π Results (Baseline vs Fine-Tuned)
| Model | ROUGE-1 | ROUGE-2 | ROUGE-L |
|---|---|---|---|
| GPT-2 (baseline) | ~0.16 | ~0.09 | ~0.12 |
| Phi-2 (baseline) | ~0.17 | ~0.096 | ~0.13 |
π Fine-tuned model shows improved contextual summarization capability.
π Usage
πΉ Load Model
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("prasanna030/gpt2-qlora-summarizer")
tokenizer = AutoTokenizer.from_pretrained("prasanna030/gpt2-qlora-summarizer")
π‘ Intended Use
News article summarization
Content condensation
Educational demos for fine-tuning LLMs
Low-resource NLP experimentation
β οΈ Limitations
GPT-2 is not inherently optimized for summarization
May generate:
repetitive text
incomplete summaries
Performance limited due to:
small dataset subset
lightweight training
π« Out-of-Scope Use
Not suitable for:
critical decision-making
medical/legal summarization
factual verification tasks
π§ Key Insight
This project demonstrates that:
Parameter-efficient fine-tuning methods like QLoRA can significantly improve model performance even on limited hardware.
π¦ Training Environment
Platform: Google Colab
GPU: T4
Libraries:
transformers
peft
datasets
bitsandbytes
π License
This model follows the license of the base model (GPT-2).
π Acknowledgements
Hugging Face π€
CNN/DailyMail Dataset
Open-source LLM community
π¬ Contact
Developed by Prasanna Nagarale