To save and resume PyTorch training, put the model, optimizer, LR scheduler, GradScaler, step, RNG states and data loader position into one dict, write it with torch.save to a temporary file and rename it, then load every piece back with load_state_dict before the loop continues. On Nodus you write that file to /nodus/state , and Nodus copies it during the run and restores it into the next attempt when a machine is reclaimed, so the same code survives restarts. In our test, a resume with every piece matched an uninterrupted run bit for bit, and leaving out only the scheduler moved final eval loss by 2.21%.
This post is the PyTorch API side: the exact save/load code, the loading errors current PyTorch throws, and a test that proves your resume is exact. For checkpoint cadence and preemption handling, see how to make spot GPU training survive preemption .…