21/30
Part 5 of 6 · Generation, and the whole roundLearn and do
One end-to-end test runs every part
Then the end-to-end test. Train on a short text until the model memorizes it. Generate from its first few tokens to well past block_size, and compare with the text.
That one test runs the batch function, the model, the loss, the optimizer and generate together. It takes seconds, so one is enough.
In the editor is the practice's generate, which crops the wrong end of the window. Fix it, so that every new token is the model's pick given the most recent model.block_size tokens.