Skip to main content
With checkpointing enabled, you can manage your model checkpoints seamlessly and avoid common training issues.

Benefits of checkpointing

  • Avoid catastrophic out of disk errors: We mount additional storage at the checkpointing directory to help avoid out of disk errors during your training run.
  • Maximize GPU utilization: A separate process uploads the checkpoint directory to cloud storage in the background, so your GPUs keep training instead of waiting on uploads.
  • Seamless checkpoint management: Uploaded checkpoints are ready to browse, deploy, or load into later jobs.

Enable checkpointing

To enable checkpointing, add a CheckpointingConfig to the Runtime and set enabled to True:

Use the checkpoint directory

Baseten exports the $BT_CHECKPOINT_DIR environment variable in your job. Write your checkpoints to this directory so Baseten can back them up. Writing a checkpoint to $BT_CHECKPOINT_DIR stages it for upload. A background process syncs the checkpoint directory to cloud storage on a recurring cycle, and a checkpoint becomes durable when its sync completes. If your training script deletes a checkpoint before it syncs, that checkpoint never reaches cloud storage: it doesn’t appear in your checkpoint list, and errors aren’t raised. Fast checkpoint rotation is the common way to hit this. Rolling-checkpoint setups that keep only the last N checkpoints, and frameworks that write to a temporary path and then rename, can both remove a checkpoint within seconds of writing it. To keep every checkpoint:
  • Keep enough checkpoint history that each checkpoint stays on disk through at least one full sync cycle.
  • Confirm a checkpoint appears in baseten train checkpoint list before your script deletes it locally.
Once a checkpoint has synced, deleting it locally is safe. Synced checkpoints persist in cloud storage even after you remove them from $BT_CHECKPOINT_DIR, so you can still reclaim disk space during long runs.

Browse checkpoints

Use the CLI to list and interactively explore checkpoint files for a job:
In interactive mode, you can fuzzy-search checkpoints, navigate their directory tree, and inspect file contents, including tensor summaries for .safetensors files. See checkpoint list for all options.

Resume training from a checkpoint

To resume training from a saved checkpoint or initialize a new job from a previous run, configure a LoadCheckpointConfig on the Runtime. Baseten downloads the referenced checkpoints into $BT_LOAD_CHECKPOINT_DIR before your start_commands run:
For more information, see loading checkpoints.

Expire checkpoints

You can give a checkpoint an expiry so Baseten deletes it for you. A checkpoint without an expiry stays until you delete it. To see when a checkpoint expires, check expires_at in List training job checkpoints, or open the job’s checkpoint list in the dashboard.

Set or remove an expiry

Call Set a training job checkpoint TTL with the checkpoint’s id from the list response and ttl_seconds, the number of seconds from now until the checkpoint expires. Use a value from 3600 (1 hour) to 315360000 (10 years), or null to remove the expiry. The response returns the checkpoint with its new expires_at. Use id, not checkpoint_id. Despite its name, checkpoint_id holds the checkpoint’s name, such as checkpoint-500. The request fails in these cases:
  • 404: the job has no checkpoint with that ID.
  • 409: Baseten hasn’t confirmed that the job’s checkpoint upload finished. If the job just stopped, try again in a few minutes. Most jobs that finished before checkpoint expiry was available never get this confirmation, so their checkpoints can’t expire.
You can always remove an expiry. Your organization may have a default expiry. If so, each new checkpoint gets it when it syncs. Changing the default doesn’t affect existing checkpoints.

When expired checkpoints are deleted

Baseten deletes expired checkpoints once a day, but only after the job has stopped. If a checkpoint expires while its job is still running, it’s deleted within about a day after the job stops. Baseten keeps an expired checkpoint if:
  • It has ever been deployed.
  • A Loops run or sampler uses it as its base model.
  • A training job is still copying it.
  • It’s inside the folder of another checkpoint that’s kept.
When all of a job’s checkpoints are deleted, Baseten also deletes any other files left in the job’s checkpoint storage.

Serve checkpoints

Serve your model checkpoints using Baseten’s serving infrastructure. Deploy a checkpoint with baseten train checkpoint deploy, or sync it into a BDN volume and mount the volume in your own config.yaml. See serving checkpoints for deployment details.
When you delete a job or project, all undeployed checkpoints are permanently deleted with no archival or recovery option. Deployed checkpoints aren’t affected. See Management for details.