Transformer Attention from Scratch in NumPy (Python)
Build transformer attention from scratch in NumPy with runnable code. Scaled dot-product, multi-head attention, causal masking, and heatmaps step by...
17 tutorials tagged NumPy on Machine Learning Plus, newest first. Most of them belong to the Gen AI category.
Build transformer attention from scratch in NumPy with runnable code. Scaled dot-product, multi-head attention, causal masking, and heatmaps step by...
Build a Mamba SSM layer from scratch in NumPy. Learn selective state spaces, implement selective scan, and benchmark SSM vs attention scaling with...
Build a speculative decoding simulator in Python. Learn the draft-verify algorithm, measure acceptance rates, and understand when it speeds up LLM...
Build sinusoidal, RoPE, and ALiBi positional embeddings from scratch in NumPy. Runnable code, heatmaps, and a clear comparison of all three schemes.
Build a Mixture of Experts (MoE) layer in Python with NumPy. Router, top-k gating, load balancing, and expert networks, with runnable code and...
Build MHA, GQA, and MQA attention from scratch in NumPy. Calculate KV cache VRAM for Llama 3 70B, Mistral 7B, and any model with a reusable...
Master LLM temperature, top-k, and top-p with interactive Python simulations. Runnable code, exercises, and a sampling playground to build real...
Learn how LLMs work step by step. Build an inference simulator in Python, tokenize, embed, compute attention, sample, and decode with runnable code...
Numpy.random.randint is used to get random integers from low to high values. The low value is included while the high value is excluded while...
The numpy.random.uniform() function is used to create an array with random samples from a uniform probability distribution of given low and high...
The numpy.sort() function in python is used to sort the array along a specified axis.
numpy.median function is used to calculate the median of an array along a specific axis or multiple axes
The numpy.where() function is used to filter data based on the conditions provided. These conditions can vary.
The numpy.random.rand() function is used to generate random float values from a uniform distribution over [0,1). These values can be extracted as a...
The numpy.reshape() is used to reshape a numpy array without changing the data in the array. Read on to know all about reshaping numpy arrays.
This is part 2 of the mega numpy tutorial. In this part, I go into the details of the advanced features of numpy arrays that are essential for data...
This is part 1 of the numpy tutorial covering all the core aspects of performing data manipulation and analysis with numpy's ndarrays. Numpy is the...