Skip to content

Instantly share code, notes, and snippets.

@Vvkmnn
Vvkmnn / microgpt.py
Created February 24, 2026 12:05 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp

Keybase proof

I hereby claim:

  • I am vvkmnn on github.
  • I am vvkmnn (https://keybase.io/vvkmnn) on keybase.
  • I have a public key whose fingerprint is AF5C 4B81 C15D 9A27 7335 59AB 53F6 E0AD 536F D98E

To claim this, I am signing this object: