rasbt-LLMs-from-scratch/ch04/01_main-chapter-code
Sebastian Raschka d6c3990c57
Training on MPS in PyTorch 2.9 (#900)
* Training on MPS in PyTorch 2.9

* update
2025-11-01 16:55:09 -05:00
..
ch04.ipynb Training on MPS in PyTorch 2.9 (#900) 2025-11-01 16:55:09 -05:00
exercise-solutions.ipynb Uv workflow improvements (#531) 2025-02-16 13:16:51 -06:00
gpt.py fixed num_workers (#229) 2024-06-19 17:36:46 -05:00
previous_chapters.py Make quote style consistent (#891) 2025-10-21 19:42:33 -05:00
README.md add main and optional sections 2024-06-19 17:48:25 -05:00
tests.py Make quote style consistent (#891) 2025-10-21 19:42:33 -05:00

Chapter 4: Implementing a GPT Model from Scratch To Generate Text

Main Chapter Code

  • ch04.ipynb contains all the code as it appears in the chapter
  • previous_chapters.py is a Python module that contains the MultiHeadAttention module from the previous chapter, which we import in ch04.ipynb to create the GPT model

Optional Code

  • gpt.py is a standalone Python script file with the code that we implemented thus far, including the GPT model we coded in this chapter