This project reproduces the core embedding pipeline from Chapter 2 of Build a Large Language Model (From Scratch). It demonstrates how raw text is tokenized, split into fixed-length sequences, and transformed into embeddings suitable for training a language model.
- Python 3.9+
- PyTorch
- tiktoken
Install the minimal dependencies:
pip install torch tiktokenembeddings.ipynb— Main notebook implementing tokenization, sliding windows, embeddings, and a small experiment.the-verdict.txt— Input text used for tokenization and dataset creation.
- Ensure
the-verdict.txtis in the same directory asembeddings.ipynb. - Start Jupyter Notebook:
jupyter notebook
- Open
embeddings.ipynband run all cells.
The notebook runs end-to-end without additional configuration.