Lab 3 of 3about 45 minutes
Open up a real transformer
It uses what you learned in Position, The transformer block and Encoders and decoders.
You will run a real model's block by hand from its own parts, run all 28 that way and read the stream after each, move every place 10,000 along, and test what each token can see in a decoder and in an encoder.
- A first runRun it
- One block by handYour turn
- The stream, block by blockYour turn
- Every place moved alongYour turn
- What each token can seeYour turn
- Two ways to get it wrongRun it
- On your own: fill a gapOn your own
curl -LsSf https://astral.sh/uv/install.sh | sh
cd learn-nlp-transformers/labs/nlp-lab-open-transformer/starter
uv syncWhen you have run it
After step 3, stream.py reads the stream at " the" after each block. After which block does " Antarctic" first come out on top?
Run on macOS on an M1 Max, uv 0.11.15, Python 3.12, PyTorch 2.15.0, Transformers 5.25.0. Checked on .
