Smash the like button if you’re also excited to see break down on how to build the Deepseek R1 from scratch!🚀
Andrej Karpathy
865K subscribersWe reproduce the GPT-2 (124M) from scratch. This video covers the whole process: First we build the GPT-2 network, then we ...
If anyone is following from nn-zero-to-hero implementation a...
61 Comments
TheAIGRID
99.5k views • 1 day ago
Wes Roth
91.1k views • 1 day ago
Wes Roth
11.6k views • 1 day ago
AI For Humans
2.1k views • 2 days ago
Wes Roth
79.9k views • 2 days ago
TheAIGRID
21.2k views • 2 days ago
Wes Roth
10.0k views • 2 days ago
AI For Humans
25.0k views • 3 days ago
TheAIGRID
13.6k views • 3 days ago
Wes Roth
80.3k views • 3 days ago
Shelf will be hidden for 30 daysUndo
Wes Roth
13.8k views • 3 days ago
Wes Roth
24.6k views • 4 days ago
TheAIGRID
8.1k views • 4 days ago
AI For Humans
8.9k views • 5 days ago
Wes Roth
29.3k views • 5 days ago
TheAIGRID
17.6k views • 5 days ago
TheAIGRID
49.3k views • 1 week ago
AI Jason
31.5k views • 1 week ago
Wes Roth
19.4k views • 1 week ago
Wes Roth
15.0k views • 1 week ago
Wes Roth
201.6k views • 1 week ago
TheAIGRID
32.6k views • 1 week ago
Wes Roth
148.3k views • 1 week ago
TheAIGRID
3.3k views • 1 week ago
TheAIGRID
23.5k views • 1 week ago
Wes Roth
45.1k views • 1 week ago
AI Explained
90.5k views • 1 week ago
Wes Roth
17.4k views • 1 week ago
AI For Humans
18.8k views • 1 week ago
Wes Roth
4.9k views • 1 week ago
AI Jason
16.1k views • 1 week ago
Wes Roth
51.5k views • 1 week ago
TheAIGRID
439.3k views • 1 week ago
AI Explained
95.2k views • 1 week ago
Wes Roth
103.7k views • 1 week ago
AI For Humans
25.6k views • 1 week ago
Wes Roth
53.8k views • 1 week ago
AI Jason
7.6k views • 1 week ago
TheAIGRID
31.1k views • 1 week ago
AI For Humans
1.8k views • 1 week ago
AI Explained
74.6k views • 1 week ago
Wes Roth
62.3k views • 1 week ago
TheAIGRID
37.3k views • 2 weeks ago
Wes Roth
9.5k views • 2 weeks ago
Wes Roth
3.0k views • 2 weeks ago
Wes Roth
5.9k views • 2 weeks ago
Wes Roth
13.9k views • 2 weeks ago
TheAIGRID
39.8k views • 2 weeks ago
AI For Humans
13.8k views • 2 weeks ago
Wes Roth
99.4k views • 2 weeks ago
Wes Roth
58.1k views • 2 weeks ago
AI For Humans
1.5k views • 2 weeks ago
TheAIGRID
9.6k views • 2 weeks ago
TheAIGRID
35.8k views • 3 weeks ago
AI For Humans
21.2k views • 3 weeks ago
AI For Humans
1.3k views • 3 weeks ago
TheAIGRID
29.3k views • 3 weeks ago
AI Jason
24.4k views • 3 weeks ago
AI For Humans
1.5k views • 3 weeks ago
AI For Humans
1.7k views • 3 weeks ago
TheAIGRID
11.6k views • 4 weeks ago
TheAIGRID
24.4k views • 1 month ago
AI For Humans
12.7k views • 1 month ago
TheAIGRID
13.6k views • 1 month ago
TheAIGRID
22.0k views • 1 month ago
TheAIGRID
7.6k views • 1 month ago
TheAIGRID
39.1k views • 1 month ago
AI Explained
98.3k views • 1 month ago
TheAIGRID
27.7k views • 1 month ago
AI Explained
60.0k views • 1 month ago
AI For Humans
17.2k views • 1 month ago
TheAIGRID
5.9k views • 1 month ago
TheAIGRID
50.8k views • 1 month ago
AI Jason
45.3k views • 1 month ago
AI For Humans
16.5k views • 1 month ago
AI Explained
92.6k views • 1 month ago
AI Explained
56.7k views • 1 month ago
AI For Humans
10.3k views • 1 month ago
AI Jason
221.8k views • 1 month ago
AI Explained
72.1k views • 1 month ago
AI For Humans
11.3k views • 1 month ago
AI For Humans
3.4k views • 2 months ago
AI Explained
108.0k views • 2 months ago
AI For Humans
14.8k views • 2 months ago
AI Jason
97.6k views • 2 months ago
AI Explained
135.6k views • 2 months ago
AI Explained
93.2k views • 2 months ago
AI For Humans
7.6k views • 2 months ago
AI Jason
211.8k views • 2 months ago
AI For Humans
949 views • 2 months ago
AI Jason
16.2k views • 2 months ago
AI For Humans
987 views • 2 months ago
AI For Humans
1.1k views • 2 months ago
AI Explained
117.1k views • 2 months ago
AI For Humans
11.2k views • 2 months ago
AI Jason
82.4k views • 2 months ago
AI For Humans
1.0k views • 2 months ago
AI Explained
109.7k views • 3 months ago
Andrej Karpathy
1.4M views • 3 months ago
AI Explained
135.2k views • 3 months ago
AI Jason
189.7k views • 3 months ago
AI Explained
111.2k views • 3 months ago
Andrej Karpathy
2.6M views • 3 months ago
AI Jason
14.7k views • 3 months ago
AI Explained
122.8k views • 3 months ago
AI Jason
18.1k views • 3 months ago
AI Explained
107.6k views • 4 months ago
AI Explained
182.7k views • 4 months ago
AI Jason
51.4k views • 4 months ago
AI Explained
106.0k views • 4 months ago
AI Jason
46.6k views • 4 months ago
AI Jason
43.4k views • 4 months ago
AI Explained
108.3k views • 4 months ago
AI Jason
68.1k views • 4 months ago
AI Explained
287.4k views • 5 months ago
Andrej Karpathy
34.7k views • 5 months ago
AI Jason
96.7k views • 5 months ago
AI Explained
87.3k views • 5 months ago
AI Explained
74.9k views • 5 months ago
AI Explained
153.6k views • 5 months ago
AI Explained
116.9k views • 5 months ago
AI Jason
62.6k views • 6 months ago
AI Jason
325.6k views • 7 months ago
AI Jason
151.4k views • 8 months ago
AI Jason
201.3k views • 8 months ago
AI Jason
31.3k views • 8 months ago
AI Jason
19.7k views • 9 months ago
AI Jason
124.6k views • 10 months ago
Andrej Karpathy
811.3k views • 11 months ago
Morningside AI
13.8k views • 1 year ago
Andrej Karpathy
813.6k views • 1 year ago
Morningside AI
4.2k views • 1 year ago
Morningside AI
10.1k views • 1 year ago
Andrej Karpathy
2.8M views • 1 year ago
Morningside AI
26.7k views • 1 year ago
Andrej Karpathy
5.7M views • 2 years ago
Andrej Karpathy
223.2k views • 2 years ago
Andrej Karpathy
268.3k views • 2 years ago
Andrej Karpathy
384.0k views • 2 years ago
Andrej Karpathy
423.4k views • 2 years ago
61 Comments
Smash the like button if you’re also excited to see break down on how to build the Deepseek R1 from scratch!🚀
I am following your work in C++ now in addition to Raff K. I think you would love to render float space, I do this.
Thank you, thanks a lot Andrej, for providing such a course for free, learnt a lot from this course, and am very thankful to you :)
I'm training my GPT2 model on an old 730 card with 2GB ram
It will also run a pre-trained GPT2 LLM out of the box, but you have to use/install python3.7 and CUDA 9.2 to support it.
    See More
Hello Andrej, thank you so much for creating and sharing such high quality resources. It's really impressive and super helpful.
If anyone is following from nn-zero-to-hero implementation and confused about the reason to transpose these openai's weight matrices [attn.c_attn.weight', 'attn.c_proj.weight&     See More
The fact that the number of current subs and views are pretty close is driving me crazy!
Smash the like button if you’re also excited to see break down on how to build the Deepseek R1 from scratch!🚀     See Less
I am following your work in C++ now in addition to Raff K. I think you would love to render float space, I do this.     See Less
Thank you, thanks a lot Andrej, for providing such a course for free, learnt a lot from this course, and am very thankful to you :)     See Less
I'm training my GPT2 model on an old 730 card with 2GB ram
It will also run a pre-trained GPT2 LLM out of the box, but you have to use/install python3.7 and CUDA 9.2 to support it.
    See More you've ever taken a backprop class in college, you can use "gradient accumulation" to effectively have a minibatch size of any size you want, with the small memory footprint of a single sample.    See Less
Thanks!     See Less
Hello Andrej, thank you so much for creating and sharing such high quality resources. It's really impressive and super helpful.     See Less
Andrej! Multimodal. RAG! 🎉 🙏🙏🤗     See Less
If anyone is following from nn-zero-to-hero implementation and confused about the reason to transpose these openai's weight matrices [attn.c_attn.weight', 'attn.c_proj.weight&     See More ;mlp.c_fc.weight], here's an explanation.
In previous videos, we simply defined our own Linear class as
class Layer:
def __init__(self,fan_in, fan_out, bias=False):
self.w = torch.randn((fan_in, fan_out),generator = g) #/ (fan_in)**(0.5) # applying kaiming init
self.bias = bias
if bias:
self.b = torch.zeros(fan_out)
def __call__(self, x):
y = x @ self.w
self.out = y + self.b if self.bias else y
return self.out
But this is a slight deviation from pytorch's implementation, If you go to pytorch's nn.Linear documentation, the weight matrix is constructed with shape (out_features,in_features) and then while applying this weight matrix it is simply transposed y=x@W.T + b.
which is exactly the reverse of what we did in our previous implementation.
so the proper way is to adhere to pytorch's implementation i.e if we define linear layer nn.Linear(fan_in,fan_out) our weight will have shape (fan_out,fan_in)    See Less
The fact that the number of current subs and views are pretty close is driving me crazy!     See Less
God bless you     See Less