Downloads · 30 days
974
58% of all-time downloads
Tanaybh/nano-gpt-from-scratch
nano-gpt-from-scratch is a text generation model from Tanaybh. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Hey there! Welcome to my tiny language model. I built this GPT from scratch as a learning project, and honestly, it was pretty fun watching it learn to generate text!
Downloads · 30 days
974
58% of all-time downloads
All-time downloads
1.7K
Public
Parameters
1.1M
798 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors4.3 MB · 97%
From the Hugging Face model README
Hey there! Welcome to my tiny language model. I built this GPT from scratch as a learning project, and honestly, it was pretty fun watching it learn to generate text!
This is a super small GPT-2 style language model that I trained on my laptop. It's not going to write your essays or solve world hunger, but it's a cool demonstration of how these language models actually work under the hood.
Think of it as a baby GPT - it can generate text, but don't expect Shakespeare. More like... an enthusiastic toddler who just learned to talk.
Want to try it out? Here's how:
from transformers import pipeline
# Load the model
generator = pipeline('text-generation', model='Tanaybh/nano-gpt-from-scratch')
# Generate some text
output = generator(
"The meaning of life is",
max_new_tokens=30,
do_sample=True,
temperature=0.8
)
print(output[0]['generated_text'])
I gave it the prompt: "**The **"
And it generated:
The × 60 munitions, and injuries were found in the taxonomy in the south, the east of the
Not bad for a tiny model trained in a few hours, right?
I trained this model from scratch using:
The whole thing runs on a regular laptop - no fancy GPU clusters needed!
Let's be real here:
I wanted to understand how language models work by building one myself. Sure, I could've just fine-tuned a pre-trained model, but where's the fun in that? This project taught me about:
Plus, now I can say I trained a language model from scratch on my laptop. Pretty cool, right?
Some things I might try:
MIT - Feel free to use this however you want! Learn from it, break it, improve it. That's what it's here for.
Built with:
Note: This is a learning project and experimental model. Use it for fun and education, not production systems!
If you found this interesting or helpful, feel free to star the repo or reach out. Always happy to chat about ML stuff!
Last updated: October 05, 2025