Skip to content

Instantly share code, notes, and snippets.

@ShaneIsley
ShaneIsley / microgpt.py
Created March 2, 2026 22:36 — 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
[
{
"caption": "Reg Replace: Format VTT",
"command": "reg_replace",
"args": {"replacements": ["remove_timestamps", "remove_numbered_lines","remove_empty_lines","remove_line_endings","remove_WEBVTT_literal","remove_v_tags"]
}
},
]
[
['00-00-00', 'XEROX CORPORATION'],
['00-00-01', 'XEROX CORPORATION'],
['00-00-02', 'XEROX CORPORATION'],
['00-00-03', 'XEROX CORPORATION'],
['00-00-04', 'XEROX CORPORATION'],
['00-00-05', 'XEROX CORPORATION'],
['00-00-06', 'XEROX CORPORATION'],
['00-00-07', 'XEROX CORPORATION'],
['00-00-08', 'XEROX CORPORATION'],