Tiny GPT is an educational decoder-only Transformer trained from scratch on
the
TinyStories
dataset. The implementation is intentionally small and readable.
This repository contains custom Transformers code. Review it before enabling
trust_remote_code.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3repo_id = "alainbrown/tiny-gpt"
4tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
5model = AutoModelForCausalLM.from_pretrained(repo_id, trust_remote_code=True)
6
7inputs = tokenizer("Once upon a time", return_tensors="pt")
8logits = model(**inputs).logits
This model is intended for education and experimentation. It is not intended
for production, factual question answering, or safety-critical applications.
The model is small, trained on synthetic children's stories, and has not been
comprehensively evaluated. It may produce incoherent, repetitive, incorrect,
or inappropriate text. English is the only supported language.
The training pipeline is available in the linked GitHub repository. This model
repository excludes optimizer and progress state and contains inference files
only.