Skip to main content
Checkpointing syncs the files your training job writes to $BT_CHECKPOINT_DIR to Baseten storage. From there, you can load them into a new job, download them, or deploy them.

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 there. Baseten mounts a separate volume at that path, so checkpoints don’t fill the container’s disk, and a background process syncs the directory to cloud storage on a recurring cycle. A checkpoint becomes durable when its sync completes. If your training script deletes a checkpoint before it syncs, that checkpoint never reaches cloud storage, and no error is raised. Fast checkpoint rotation is the common way to hit this. Two setups can remove a checkpoint within seconds of writing it: rolling checkpoints that keep only the last N, and frameworks that write to a temporary path and then rename it. To keep every checkpoint, confirm that a checkpoint’s SYNC column reads COMPLETE before your script deletes it locally. List the job’s checkpoints to read the column. 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.

Next steps