Skip to content

Instantly share code, notes, and snippets.

View JonasLoos's full-sized avatar
💭
404

Jonas Loos JonasLoos

💭
404
View GitHub Profile
@JonasLoos
JonasLoos / microgpt.py
Last active February 16, 2026 23:25 — forked from karpathy/microgpt.py
microgpt
"""mircrogpt by @karpathy, edited by @jonasloos: train a language model on it's own code, without dependencies"""
import math
import random
random.seed(42) # Let there be order among chaos
# Let there be data (this file) and tokenize it
text = open(__file__).read().lower()
lines = [line for line in text.split('\n') if line.strip() and not line.strip().startswith('#')]