Remove leftover instances of self.tokenizer (#201)

* Remove leftover instances of self.tokenizer

* add endoftext token
This commit is contained in:
Sebastian Raschka
2024-06-08 14:57:34 -05:00
committed by GitHub
parent c303a7f36d
commit 72a073bbbf
13 changed files with 18 additions and 23 deletions

View File

@@ -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",