Skip to content

Instantly share code, notes, and snippets.

View tofudfy's full-sized avatar

Fuyang Deng tofudfy

View GitHub Profile
@tofudfy
tofudfy / min-char-rnn.py
Created April 30, 2026 07:42 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@tofudfy
tofudfy / microgpt.py
Created April 30, 2026 07:41 — 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