Skip to page content
SAVRN
Search Plan a project

Open-weight model

preemption-safe-training-template

by Viswaretas kotra Viswa-k/preemption-safe-training-template

preemption-safe-training-template is an open-weight model from Viswaretas kotra, released under Apache License 2.0. Its published files total 5.5 KB.

A minimal PyTorch training loop that survives spot / interruptible GPU preemption. Copy train.py and swap in your model and data. 1. Keeps all recovery state (weights, optimizer, RNG, step) in one directory: $NODUSSTATEDIR or./state. 2.

Parameters—
Context—
Weights5.5 KB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads—

Model Card

By Viswaretas kotra, published under apache-2.0, revision 466343e4b185.

A minimal PyTorch training loop that survives spot / interruptible GPU preemption. Copy train.py and swap in your model and data. 1. Keeps all recovery state (weights, optimizer, RNG, step) in one directory: $NODUSSTATEDIR or./state. 2. Writes checkpoints atomically (temp file, then os.replace). 3. Resumes from the last checkpoint on startup. 4. Saves on a timer, and again immediately when the platform sends a checkpoint request. Nodus copies the state directory off the machine before a reclaim and restores it on the replacement, so preemptions cost minutes instead of the whole run. New accounts get a $30 starter grant (valid for 30 days), so the first runs need no card. Add --dry-run to…

Read Viswaretas kotra's full model card

A minimal PyTorch training loop that survives spot / interruptible GPU preemption. Copy train.py and swap in your model and data.

What it does

  1. Keeps all recovery state (weights, optimizer, RNG, step) in one directory: $NODUS_STATE_DIR or ./state.
  2. Writes checkpoints atomically (temp file, then os.replace).
  3. Resumes from the last checkpoint on startup.
  4. Saves on a timer, and again immediately when the platform sends a checkpoint request.

Run locally

pip install torch
python train.py          # Ctrl+C midway, run again: it resumes

Run on a cheap interruptible GPU with Nodus

Nodus copies the state directory off the machine before a reclaim and restores it on the replacement, so preemptions cost minutes instead of the whole run.

pip install nodus-compute
nodus login
nodus run --gpu L4 --image nodus/pytorch --interruptible --checkpoint /nodus/state -d -- python train.py
nodus logs -f job/<name>

New accounts get a $30 starter grant (valid for 30 days), so the first runs need no card. Add --dry-run to see the cost estimate before anything starts.

Picking a checkpoint interval

Aim for at least 4 checkpoints per expected run and keep time spent saving under about 10% of runtime. Set SAVE_EVERY_SEC accordingly.

More

  • Full guide: https://www.nodus-compute.ai/docs/guides/checkpoints/
  • Write-up: https://dev.to/viswaretas_kotra/how-to-make-gpu-training-survive-spot-preemption-without-babysitting-it-44k6
  • GPU price index dataset: https://huggingface.co/datasets/Viswa-k/cloud-gpu-pricing

Identity and Version

Repository
Viswa-k/preemption-safe-training-template
Publisher
Viswaretas kotra
Task
Not stated by the source
Modality
Other
Library
pytorch
Parameters
Not stated by the source
Languages
gpu
Revision
466343e4b185e8201127735b9dc489f75e3d7c92
First published
2026-10-09
Last updated
2026-10-09

Files and Weights

3 files, 5.5 KB in total.

Configuration1 file · 2.3 KB
Documentation1 file · 1.8 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
train.pyConfiguration2.3 KB —
README.mdDocumentation1.8 KB —
.gitattributesRepository1.5 KB —

License and Download

License
apache-2.0
Access
Open weights, no gate
Download from Viswaretas kotra

Released by Viswaretas kotra through its official repository on Hugging Face. Read the license.

Questions About preemption-safe-training-template

Can I use preemption-safe-training-template commercially?

Yes. preemption-safe-training-template is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.