A guided tour of PyTorch, AI/ML fundamentals, and patterns for working with bigger-than-memory data. Each numbered folder is a self-contained lesson with one runnable script and a README that explains the concept.
- Install Python 3.10+ and create a virtual environment.
pip install -r requirements.txt- Walk the lessons in order. Each script runs on CPU in a few seconds.
- Read the lesson's README first, then run the script and tweak the numbers.
python 01_tensors/main.py| # | Folder | What you learn |
|---|---|---|
| 01 | tensors | The Tensor — PyTorch's NumPy-on-GPU. Creation, shapes, broadcasting, devices. |
| 02 | autograd | Automatic differentiation. How .backward() and requires_grad power every model. |
| 03 | linear_regression | A full training loop from scratch on synthetic data. The "hello world" of ML. |
| 04 | logistic_regression | Binary classification, sigmoid, BCE loss, decision boundaries. |
| 05 | mlp | Multilayer perceptron with nn.Module. Hidden layers, activations, generalization. |
| 06 | cnn | A convolutional network for images. Conv, pooling, feature maps. |
| 07 | dataset_dataloader | Dataset, DataLoader, batching, shuffling, transforms. |
| 08 | training_loop | A reusable train/val loop with metrics, early stopping, and checkpoints. |
| 09 | rnn_sequence | LSTMs on a synthetic sequence task. Hidden state, BPTT. |
| 10 | transformer | A tiny self-attention model. The block diagram behind GPT/BERT, in <100 lines. |
| 11 | big_data | Streaming with IterableDataset for data that doesn't fit in RAM. |
Three pieces, repeated:
- A model — a function
f(x; θ)with learnable parametersθ(a matrix multiply, a stack of layers, etc.). - A loss — a number that says how wrong
f(x; θ)is on training data. - An optimizer — gradient descent, which nudges
θto make the loss smaller.
Every lesson is a variation on those three pieces. Once you see them, the rest is engineering.
- The PyTorch 60-minute blitz
- Andrej Karpathy's "Neural Networks: Zero to Hero" videos
- The d2l.ai book (free)