PythiloLesson 5 of 6 · progress kept in this browser

Practice in Lab: Project: Resume real transformer training exactly →

Download complete project source →

Project: Resume real transformer training exactly

Restoring model weights alone is not an exact continuation. AdamW moments and step counters affect the next update; dropout consumes the Torch RNG; the sampler owns a Python RNG, an explicit permutation and a cursor. Save these together at an optimizer-step boundary. Construct a fresh model and optimizer, restore every component, then compare every final tensor and every observed loss against an uninterrupted CPU run.

Your task

Interrupt LoRA mid-epoch, save AdamW and both RNGs, restore a fresh process state and match the uninterrupted trajectory. Implement run_project(output, quick=False). Follow the reference report/artifact schema; the checks run quick=True with actual pretrained weights and real data. The full dataset is the default.

This lesson uses pythilo_finetune and torch, which Python in this browser does not include. Read it here, and run and check it in the Pythilo app on iPhone or iPad.