[Andrej Karpathy] Let’s build GPT: from scratch, in code, spelled out.
🎯 Загружено автоматически через бота:
🚫 Оригинал видео:
📺 Данное видео принадлежит каналу «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
72 views
0
1
1 month ago 01:55:57 5
[Andrej Karpathy] Building makemore Part 3: Activations & Gradients, BatchNorm
1 month ago 01:55:23 12
[Andrej Karpathy] Building makemore Part 4: Becoming a Backprop Ninja
1 month ago 00:56:21 4
[Andrej Karpathy] Building makemore Part 5: Building a WaveNet
1 month ago 01:56:19 72
[Andrej Karpathy] Let’s build GPT: from scratch, in code, spelled out.
1 month ago 00:59:47 11
[Andrej Karpathy] [1hr Talk] Intro to Large Language Models
1 month ago 04:01:25 13
[Andrej Karpathy] Let’s reproduce GPT-2 (124M)
1 month ago 02:13:34 2
[Andrej Karpathy] Let’s build the GPT Tokenizer
1 month ago 00:03:19 1
How To Study Hard - Richard Feynman
1 month ago 00:26:10 1
Attention in transformers, visually explained | Chapter 6, Deep Learning
1 month ago 00:27:14 1
How large language models work, a visual intro to transformers | Chapter 5, Deep Learning
2 months ago 00:27:13 10
But what is a GPT? Visual intro to transformers | Chapter 5, Deep Learning
2 months ago 00:44:17 1
No Priors Ep. 80 | With Andrej Karpathy from OpenAI and Tesla
3 months ago 00:18:11 67
НОВОСТИ ИИ: Подписка на ChatGPT за 2000$
3 months ago 00:06:53 1
Elon Musk says losers use LiDAR. [Explanation video]
4 months ago 00:47:27 1
Projeto Secreto da OpenAI: Descubra as Últimas Inovações da IA e Fique Super Atualizado no IA News#6
4 months ago 00:07:41 1
Educação 100% com IA, FBI invade celular, Hype das IA no fim, e muito mais
6 months ago 00:40:08 1
The Most Important Algorithm in Machine Learning
7 months ago 00:08:29 1
CATL’s sodium hybrid battery will be 30% cheaper & revolutionise the world
7 months ago 00:08:55 1
Tesla reveals timelline for massive electric Semi production at $ factory
9 months ago 00:26:53 1
Vedal & Neuro Build A Language Model From Scratch
9 months ago 00:16:39 1
Phi-1: A ’Textbook’ Model
10 months ago 00:20:13 1
GPT-5: Everything You Need to Know So Far
12 months ago 00:14:07 1
“Что в имени тебе моем?“ Учимся генерировать новые имена у звездного разработчика Tesla и OpenAI.
1 year ago 00:59:48 22
Введение в большие языковые модели от Andrej Karpathy