A fine-tuned GPT-2 language model designed to generate short, humorous, and social-media-style meme captions from user-provided prompts.
The model learns common meme caption patterns such as:
When ...
Me when ...
POV: ...
How it feels when ...
That one friend who ...
It can generate multiple caption variations for a single prompt.
🚀 Model Overview
Property
Details
Base Model
GPT-2
Task
Meme Caption Generation
Language
English
Framework
PyTorch
Library
🤗 Transformers
Model Type
Autoregressive Language Model
Output
Short Meme Captions
Fine-Tuning
Supervised Fine-Tuning
Format
Safetensors
✨ Features
Generate meme captions from a text prompt
Generate multiple caption variations
Supports prompt-based and random caption generation
Adjustable text-generation parameters
Designed for short, humorous, social-media-style text
Example:
Prompt
When you finally get your salary
Possible generations
text
1When you finally get your salary and your bills were waiting for you.
23Me checking my bank account after getting paid.
45POV: You finally get paid but somehow you're still broke.
🧠 Model Architecture
This model is based on GPT-2, an autoregressive Transformer language model.
During fine-tuning, the model was trained to learn the distribution and writing style of meme captions.
Each training example follows a structure similar to:
<|capbos|> meme caption <|capeos|>
where:
<|capbos|> marks the beginning of a caption
<|capeos|> marks the end of a caption
<|cappad|> is used as the padding token
This allows the model to learn where meme captions begin and end.
📊 Training
The model was fine-tuned on a custom meme-caption dataset containing short English meme captions collected and processed for this project.
The dataset was cleaned and prepared before fine-tuning to improve training quality.
The preprocessing pipeline included:
Caption extraction
Text cleaning
Duplicate removal
Dataset preparation
Tokenization
Train/validation split
GPT-2 fine-tuning
The training process used:
PyTorch
Hugging Face Transformers
AdamW optimization
Learning-rate scheduling
Gradient accumulation
Validation monitoring
Early stopping
⚙️ Generation Parameters
The model can be used with sampling-based generation.
The YOLO-based text detector was developed to identify meme text regions and improve the quality of captions extracted from meme images during dataset preparation.
📈 Future Improvements
Potential improvements include:
Increasing the size and diversity of the training dataset
Improving dataset quality and caption filtering
Adding automated generation-quality ranking
Removing noisy or incomplete generations
Fine-tuning larger language models
Improving semantic control over generated captions
Adding multilingual meme caption generation
Improving safety filtering
Adding image-to-caption generation
👨💻 Project
This model was developed as part of an end-to-end AI Meme Caption Generator project combining computer vision, natural language processing, and generative AI.