Skip to content

Commit 661a6e8

Browse files
Sajjad BalochPrinceSajjadHussainrasbt
authored
Fix: Typo in appendix_d.py comments. (#682)
* Fix: pkg/llms_from_scratch/appendix_d.py * minor language typo fix * fix 691 --------- Co-authored-by: PrinceSajjadHussain <[email protected]> Co-authored-by: rasbt <[email protected]>
1 parent 564e986 commit 661a6e8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

appendix-D/01_main-chapter-code/appendix-D.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@
615615
" if global_step > warmup_steps:\n",
616616
" torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0) \n",
617617
" else:\n",
618-
" if global_step >= warmup_steps: # the book originally used global_step > warmup_steps, which lead to a skipped clipping step after warmup\n",
618+
" if global_step >= warmup_steps: # the book originally used global_step > warmup_steps, which led to a skipped clipping step after warmup\n",
619619
" torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)\n",
620620
" \n",
621621
" optimizer.step()\n",

pkg/llms_from_scratch/appendix_d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def train_model(model, train_loader, val_loader, optimizer, device,
6666
if global_step > warmup_steps:
6767
torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
6868
else:
69-
if global_step >= warmup_steps: # the book originally used global_step > warmup_steps, which lead to a skipped clipping step after warmup
69+
if global_step >= warmup_steps: # the book originally used global_step > warmup_steps, which led to a skipped clipping step after warmup
7070
torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
7171

7272
optimizer.step()

pkg/llms_from_scratch/ch03.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class PyTorchMultiHeadAttention(nn.Module):
160160
def __init__(self, d_in, d_out, num_heads, dropout=0.0, qkv_bias=False):
161161
super().__init__()
162162

163-
assert d_out % num_heads == 0, "embed_dim is indivisible by num_heads"
163+
assert d_out % num_heads == 0, "d_out is indivisible by num_heads"
164164

165165
self.num_heads = num_heads
166166
self.head_dim = d_out // num_heads

0 commit comments

Comments
 (0)