One-page references for PyTorch Lightning, LLM fine-tuning with LoRA and QLoRA, and neural network training. Each one has working code, the formulas behind it, and the flags you actually use. Print it or keep it open next to your editor.
LightningModule hooks, LightningDataModule, Trainer flags, callbacks, logging, checkpoints, multi-GPU training and debugging flags.
A tiny GPT from scratch, pretraining loop, tokenizers, small open models, generation, LoRA, QLoRA, PEFT, TRL SFT and GPU memory per parameter.
Activation functions, loss functions, optimizers, LR schedules and metrics, each with its formula plus NumPy and PyTorch code, and backprop from scratch.
The code targets PyTorch 2.x, Lightning 2.x and current Hugging Face transformers, peft and trl. Every sheet is a single self-contained HTML file, so you can fix or extend it and print a new PDF.
Found a mistake? Open an issue or a pull request on GitHub. Licensed CC BY 4.0.