CoolFace
Apppublic

AishMe/sentence-completion-124m-gpt2

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
1likes
App README

๐Ÿงฉ 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

  1. 1.Type a partial sentence (or click example)
  2. 2.Adjust Temperature (low=focused, high=wild) & Top-K (low=safe, high=diverse)
  3. 3.Click Complete โ†’ Watch GPT-2 finish your sentence!

๐Ÿง  Generation Parameters

ParameterEffect
Temperature0.0 = Predictable<br>1.0 = Balanced<br>2.0+ = Creative chaos
Top-K5 = Safe words<br>50+ = Wild vocabulary

๐ŸŽฏ 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)

๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป View model code โ€ข โญ Star this Space