Myvideo

Guest

Login

Andrej Karpathy Lets build GPT: from scratch, in code, spelled out.

Uploaded By: Myvideo
1 view
0
0 votes
0

🎯 Загружено автоматически через бота: 🚫 Оригинал видео: 📺 Данное видео принадлежит каналу «Andrej Karpathy» (@AndrejKarpathy). Оно представлено в нашем сообществе исключительно в информационных, научных, образовательных или культурных целях. Наше сообщество не утверждает никаких прав на данное видео. Пожалуйста, поддержите автора, посетив его оригинальный канал. ✉️ Если у вас есть претензии к авторским правам на данное видео, пожалуйста, свяжитесь с нами по почте support@, и мы немедленно удалим его. 📃 Оригинальное описание: We build a Generatively Pretrained Transformer (GPT), following the paper “Attention is All You Need“ and OpenAI’s GPT-2 / GPT-3. We talk about connections to ChatGPT, which has taken the world by storm. We watch GitHub Copilot, itself a GPT, help us write a GPT (meta :D!) . I recommend people watch the earlier makemore videos to get comfortable with the autoregressive language modeling framework and basics of tensors and PyTorch nn, which we take for granted in this video. Links: Google colab for the video: GitHub repo for the video: Playlist of the whole Zero to Hero series so far: nanoGPT repo: my website: my twitter: our Discord channel: Supplementary links: Attention is All You Need paper: OpenAI GPT-3 paper: OpenAI ChatGPT blog post: The GPU I’m training the model on is from Lambda GPU Cloud, I think the best and easiest way to spin up an on-demand GPU instance in the cloud that you can ssh to: . If you prefer to work in notebooks, I think the easiest path today is Google Colab. Suggested exercises: EX1: The n-dimensional tensor mastery challenge: Combine the `Head` and `MultiHeadAttention` into one class that processes all the heads in parallel, treating the heads as another batch dimension (answer is in nanoGPT). EX2: Train the GPT on your own dataset of choice! What other data could be fun to blabber on about? (A fun advanced suggestion if you like: train a GPT to do addition of two numbers, i.e. a b=c. You may find it helpful to predict the digits of c in reverse order, as the typical addition algorithm (that you’re hoping it learns) would proceed right to left too. You may want to modify the data loader to simply serve random problems and skip the generation of , . You may want to mask out the loss at the input positions of a b that just specify the problem using y=-1 in the targets (see CrossEntropyLoss ignore_index). Does your Transformer learn to add? Once you have this, swole doge project: build a calculator clone in GPT, for all of -*/. Not an easy problem. You may need Chain of Thought traces.) EX3: Find a dataset that is very large, so large that you can’t see a gap between train and val loss. Pretrain the transformer on this data, then initialize with that model and finetune it on tiny shakespeare with a smaller number of steps and lower learning rate. Can you obtain a lower validation loss by the use of pretraining? EX4: Read some transformer papers and implement one additional feature or change that people seem to use. Does it improve the performance of your GPT? Chapters: intro: ChatGPT, Transformers, nanoGPT, Shakespeare baseline language modeling, code setup reading and exploring the data tokenization, train/val split data loader: batches of chunks of data simplest baseline: bigram language model, loss, generation training the bigram model port our code to a script Building the “self-attention“ version 1: averaging past context with for loops, the weakest form of aggregation the trick in self-attention: matrix multiply as weighted aggregation version 2: using matrix multiply version 3: adding softmax minor code cleanup positional encoding THE CRUX OF THE VIDEO: version 4: self-attention

Share with your friends

Link:

Embed:

Video Size:

Custom size:

x

Add to Playlist:

Favorites
My Playlist
Watch Later