Skip to content

Commit

Permalink
readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Jan 4, 2025
1 parent 4f16cea commit 6276f39
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ch02/01_main-chapter-code/dataloader.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
" return self.input_ids[idx], self.target_ids[idx]\n",
"\n",
"\n",
"def create_dataloader_v1(txt, batch_size, max_length, stride, shuffle=True, drop_last=True, num_workers=0):\n",
"def create_dataloader_v1(txt, batch_size, max_length, stride,\n",
" shuffle=True, drop_last=True, num_workers=0):\n",
" # Initialize the tokenizer\n",
" tokenizer = tiktoken.get_encoding(\"gpt2\")\n",
"\n",
Expand All @@ -130,7 +131,12 @@
"\n",
"batch_size = 8\n",
"max_length = 4\n",
"dataloader = create_dataloader_v1(raw_text, batch_size=batch_size, max_length=max_length, stride=max_length)"
"dataloader = create_dataloader_v1(\n",
" raw_text,\n",
" batch_size=batch_size,\n",
" max_length=max_length,\n",
" stride=max_length\n",
")"
]
},
{
Expand Down Expand Up @@ -186,7 +192,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 6276f39

Please sign in to comment.