Skip to content

Instantly share code, notes, and snippets.

@joshmo01
joshmo01 / microgpt.py
Created May 3, 2026 09:47 — 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 joshmo01 on github.
  • I am joshmo0146 (https://keybase.io/joshmo0146) on keybase.
  • I have a public key ASDUoUc3e3cJqS0ilb3THUWkikpKb5nKcx4iomM_ajbYGgo

To claim this, I am signing this object: