Pytorch Embedding Model Part 2

Stephen Blum · Beginner ·📐 ML Fundamentals ·1w ago

Key Takeaways

Implements a word embedding model in PyTorch using tokenization and dictionary-based indexing

Original Description

I am pumped today because we finally have a solid plan for our word embedding model, and I want to build it in PyTorch. The goal is simple. Take words, tokenize them into dictionary indexes, pad the context, and turn inputs into vectors we can train on. During training, we will predict the next word from the last three words, like found the bug leads to win, then the bug win leads to you. We hit a few snags, like a regex that did not clean punctuation and some tensor type errors, but we fixed them. We also replaced torch.nn.Embedding with our own embedding tensor and learned we can just index rows instead of doing full one hot matmul. Next up is a small data iterator for batching, then cross entropy loss, then training, and finally testing word similarity. We committed the code and we will start training tomorrow.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

📰
Why NIST Researchers Spent 10 Years Measuring Gravity
NIST researchers spent 10 years measuring gravity to improve the accuracy of the gravitational constant, a fundamental constant of the universe
IEEE Spectrum
📰
My AI Designs Rockets in 6 Simulations. A “Dumb” Baseline Nearly Kept Up.
An AI-designed rocket was tested against a simple baseline and the results were surprisingly close, highlighting the importance of experimentation in AI development
Medium · Machine Learning
📰
Why Trusted Defaults Become the New Scarcity
Trusted defaults become the new scarcity as intelligence becomes commoditized, making trusted resolution increasingly valuable
Medium · Machine Learning
📰
Intelligence Lives in the Loop
Learn how continuous resolution creates more intelligent systems by closing the loop between prediction and action
Medium · Machine Learning
Up next
Skip Lists: Coin Flips Instead of Rebalancing
DataMListic
Watch →