machine-learning

Machine learning tutorials in Python covering models, training, evaluation, and real projects.

The Attention Mechanism From Scratch in PyTorch

Every large language model you have used is, at its core, dot products, a softmax, and a weighted sum. That is the attention mechanism, and in this workshop you build it from scratch in PyTorch, tensor by tensor. You will compute Query, Key, and Value by hand on a four-word sentence, read a real heatmap, assemble multi-head attention, add causal masking, and train a tiny model that predicts text. “If you can compute it by hand once, you can debug ... Read More

Google Colab GPU Setup: Where to Run Deep Learning for Free

Your laptop does not have to suffer through deep learning. A free Google Colab GPU (Graphics Processing Unit) hands you a real Tesla T4 in a browser tab: no CUDA install, no gaming rig, no bill. This post walks through enabling it, proving it is on with one small check, the session rules that catch beginners, and a timed CPU vs GPU race you can run yourself. “The best way to get started is to stop talking and begin doing.” ... Read More

PyTorch Dataset and DataLoader: The Real Training Loop

You trained your first network on a toy set that fit in one tensor, and it felt easy. Then real data arrives, a CSV with thousands of rows or an image folder too big for memory, and the PyTorch DataLoader is the tool built for exactly that. Here you pair it with a custom Dataset, feed a network from a CSV and an image folder, run the five-step loop from memory, validate honestly, and save a checkpoint you can resume ... Read More