promptdojo_

Checkpoints and reproducibility — step 5 of 7

A 6-step momentum descent, checkpointed at step 3 and resumed — but the resumed run does NOT match the uninterrupted one. The checkpoint saved only the weight; the optimizer's velocity restarted from zero, changing the trajectory. Fix the checkpoint to save AND restore the velocity — the miniature of saving optimizer.state_dict().

The break is on line 11 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.