A from-scratch ML library, plus demos that use it. All of src/ is my work; data/ and tests/ is mostly GPT/Claude's work (fetching datasets & formatting them into my .tensor format, and writing tests to check emel's correctness).
File structure:
src/: demos that utilize the library. All.cppfiles in here are individual programs.src/README.md: docs on what eachsrc/*.cppexample is demonstrating.
src/emel/: the core emel library code.src/emel/util.h: helpers that shorten the code (important!).src/emel/tensor.{h,cpp}: tensor classsrc/emel/nn.{h,cpp}: neural network classsrc/emel/autograd.{h,cpp}: autogradsrc/emel/opt.{h,cpp}: gradient descent optimizerssrc/emel/tokenizer.{h,cpp}: tokenizers
ref/: the reference notes for the impl.ref/autograd.tex: autogradref/crossentropy.tex: proof of cross-entropy (via proper scoring rules)ref/conv2d.tex: notes on implementing the conv2d layerref/transformer.tex: attention/mha/transformersref/tf2gpt.tex: from transformers to gpt
data/: relevant training/test/etc data to be used by the codetests/: library testsmodels/: saved model weights; results of the demo training runs in top-levelsrc/.Makefile: makefile
make <source> compiles src/<source>.cpp along with the library in src/lib/; default source is specified in Makefile. Output executable goes to ./a.out.