mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
Remove leftover instances of self.tokenizer (#201)
* Remove leftover instances of self.tokenizer * add endoftext token
This commit is contained in:
committed by
GitHub
parent
c303a7f36d
commit
72a073bbbf
@@ -82,12 +82,11 @@
|
||||
"\n",
|
||||
"class GPTDatasetV1(Dataset):\n",
|
||||
" def __init__(self, txt, tokenizer, max_length, stride):\n",
|
||||
" self.tokenizer = tokenizer\n",
|
||||
" self.input_ids = []\n",
|
||||
" self.target_ids = []\n",
|
||||
"\n",
|
||||
" # Tokenize the entire text\n",
|
||||
" token_ids = self.tokenizer.encode(txt, allowed_special={'<|endoftext|>'})\n",
|
||||
" token_ids = tokenizer.encode(txt, allowed_special={'<|endoftext|>'})\n",
|
||||
"\n",
|
||||
" # Use a sliding window to chunk the book into overlapping sequences of max_length\n",
|
||||
" for i in range(0, len(token_ids) - max_length, stride):\n",
|
||||
|
||||
Reference in New Issue
Block a user