AishMe/sentence-completion-124m-gpt2
1
๐งฉ GPT-2 Sentence Completor
From-scratch GPT-2 implementation (124M parameters) with OpenAI pretrained weights!
โจ Features
- โ Interactive sentence completion
- ๐๏ธ Live controls: Temperature (creativity) + Top-K (vocabulary)
- ๐ฒ Random fun examples button
- ๐ Real-time generation
- ๐จ Simple UI
๐ฎ How to Use
- Type a partial sentence (or click example)
- Adjust Temperature (low=focused, high=wild) & Top-K (low=safe, high=diverse)
- Click Complete โ Watch GPT-2 finish your sentence!
๐ง Generation Parameters
๐ฏ Fun Examples
- "The weather today is" โ "sunny and warm"
- "My cat woke me up by" โ "jumping on my face!"
- "In a world where cats rule" โ "the humans serve tuna"
๐ง Tech Stack
From-scratch GPT-2 (124M params)
OpenAI pretrained weights
Gradio UI
Tiktoken tokenizer
PyTorch + TensorFlow (weights conversion)
๐จโ๐ป Code Structure
โโโ app.py (Gradio UI + controls)
โโโ models.py (GPT-2 architecture + weights loading)
โโโ utils.py (Helper functions)
โโโ examples.py (20+ fun prompts)
โโโ style.css (Stying on top of Gradio UI)
โโโ requirements.txt
โโโ full_code.ipynb (Entire code in python notebook)
โ๏ธ Hardware
- CPU Basic (16GB RAM) - Perfect for 124M model
- First load: ~30s (downloads 500MB weights)
- Inference: <2s per completion
Built with โค๏ธ by [AishMe](https://huggingface.co/AishMe)
