File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
ch02/01_main-chapter-code Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change 46
46
"name" : " stdout" ,
47
47
"output_type" : " stream" ,
48
48
"text" : [
49
- " torch version: 2.4 .0\n " ,
50
- " tiktoken version: 0.7 .0\n "
49
+ " torch version: 2.6 .0\n " ,
50
+ " tiktoken version: 0.9 .0\n "
51
51
]
52
52
}
53
53
],
327
327
" raw_text = f.read()\n " ,
328
328
" \n " ,
329
329
" tokenizer = tiktoken.get_encoding(\" gpt2\" )\n " ,
330
- " encoded_text = tokenizer.encode(raw_text)\n " ,
331
- " \n " ,
332
- " vocab_size = 50257\n " ,
333
- " output_dim = 256\n " ,
334
- " max_len = 4\n " ,
335
- " context_length = max_len\n " ,
336
- " \n " ,
337
- " token_embedding_layer = torch.nn.Embedding(context_length, output_dim)\n " ,
338
- " pos_embedding_layer = torch.nn.Embedding(vocab_size, output_dim)"
330
+ " encoded_text = tokenizer.encode(raw_text)"
339
331
]
340
332
},
341
333
{
342
334
"cell_type" : " code" ,
343
335
"execution_count" : 13 ,
344
- "id" : " 0128eefa-d7c8-4f76-9851-566dfa7c3745 " ,
336
+ "id" : " 15c184fe-5553-4df2-a77f-7504901b6709 " ,
345
337
"metadata" : {},
346
338
"outputs" : [
347
339
{
371
363
{
372
364
"cell_type" : " code" ,
373
365
"execution_count" : 14 ,
374
- "id" : " ff5c1e90-c6de-4a87-adf6-7e19f603291c " ,
366
+ "id" : " 739990b2-ce4c-4d17-88e3-547c8c312019 " ,
375
367
"metadata" : {},
376
368
"outputs" : [
377
369
{
415
407
"name" : " python" ,
416
408
"nbconvert_exporter" : " python" ,
417
409
"pygments_lexer" : " ipython3" ,
418
- "version" : " 3.11.4 "
410
+ "version" : " 3.10.16 "
419
411
}
420
412
},
421
413
"nbformat" : 4 ,
You can’t perform that action at this time.
0 commit comments