Summary
Full Transcript
In this lecture, we perform a hands-on project to calculate the LLM loss on a real storybook dataset! We understand how to divide the dataset into input-target pairs, and then how to find the loss between the LLM output and the target output. We understand the theory, mathematical intuition and also do the coding for the entire implementation. The key reference book which this video series very closely follows is Build a Large Language Model from Scratch by Manning Publications. All schematics and their descriptions are borrowed from this incredible book! This book serves as a comprehensive guide to understanding and building large language models, covering key concepts, techniques, and implementations. Affiliate links for purchasing the book will be added soon. Stay tuned for updates! 0:00 Lecture Objectives 3:32 Understanding the dataset 7:19 How to construct LLM input-target pairs? 14:14 How to get the LLM loss? 16:19 How to get the LLM output? 22:16 Finding the loss between the target and LLM output 26:03 Finding loss for multiple batches 33:09 Coding: Loading the dataset 35:35 Coding: Implementing the dataloader class 39:59 Coding: Creating training and validation dataloaders 45:34 Coding: implementing the LLM architecture 47:57 Coding: LLM Loss function implementation 53:43 Coding: Finding LLM Loss on our dataset 55:55 Next steps Link to code file: https://drive.google.com/file/d/1U03f--JS0He7zbUqcG5qHTBcZMa5YlM3/view?usp=sharing Link to dataset: https://github.com/rasbt/LLMs-from-scratch/blob/main/ch02/01_main-chapter-code/the-verdict.txt Tiktoken library: https://github.com/openai/tiktoken PyTorch Datasets and DataLoaders: https://pytorch.org/tutorials/beginner/basics/data_tutorial.html PyTorch Cross Entropy: https://pytorch.org/docs/stable/generated/torch.nn.functional.cross_entropy.html ================================================= ✉️ Join our FREE Newsletter: https://vizuara.ai/our-newsletter/ ================================================= Vizuara philosophy: As we learn AI/ML/DL the material, we will share thoughts on what is actually useful in industry and what has become irrelevant. We will also share a lot of information on which subject contains open areas of research. Interested students can also start their research journey there. Students who are confused or stuck in their ML journey, maybe courses and offline videos are not inspiring enough. What might inspire you is if you see someone else learning and implementing machine learning from scratch. No cost. No hidden charges. Pure old school teaching and learning. ================================================= 🌟 Meet Our Team: 🌟 🎓 Dr. Raj Dandekar (MIT PhD, IIT Madras department topper) 🔗 LinkedIn: https://www.linkedin.com/in/raj-abhijit-dandekar-67a33118a/ 🎓 Dr. Rajat Dandekar (Purdue PhD, IIT Madras department gold medalist) 🔗 LinkedIn: https://www.linkedin.com/in/rajat-dandekar-901324b1/ 🎓 Dr. Sreedath Panat (MIT PhD, IIT Madras department gold medalist) 🔗 LinkedIn: https://www.linkedin.com/in/sreedath-panat-8a03b69a/ 🎓 Sahil Pocker (Machine Learning Engineer at Vizuara) 🔗 LinkedIn: https://www.linkedin.com/in/sahil-p-a7a30a8b/ 🎓 Abhijeet Singh (Software Developer at Vizuara, GSOC 24, SOB 23) 🔗 LinkedIn: https://www.linkedin.com/in/abhijeet-singh-9a1881192/ 🎓 Sourav Jana (Software Developer at Vizuara) 🔗 LinkedIn: https://www.linkedin.com/in/souravjana131/
