This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """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('#')] |