Checkpoint Saving
1 Overview
Axolotl supports on-demand checkpoint saving during training. You can trigger checkpoints via file-based triggers (for programmatic control) or Control+C (for interactive use), and mirror checkpoints from fast local storage to a shared filesystem without blocking training.
2 File-Based Checkpoint Trigger
2.1 Configuration
Enable in your config:
dynamic_checkpoint:
enabled: true
check_interval: 10 # Optional: check every N steps (default: 10)
trigger_file_path: "axolotl_checkpoint.save" # Optional: custom filenameOptions:
- enabled: true to enable (required)
- check_interval: Steps between file checks. Default: 10. Lower = faster response, higher I/O overhead.
- trigger_file_path: Custom trigger filename. Default: axolotl_checkpoint.save
2.2 How It Works
- Rank 0 checks for trigger file every
check_intervalsteps inoutput_dir - When detected, file is deleted and checkpoint is saved
- In distributed training, rank 0 broadcasts to synchronize all ranks
2.3 Usage
Command line:
touch /path/to/output_dir/axolotl_checkpoint.saveProgrammatic:
from pathlib import Path
Path("/path/to/output_dir/axolotl_checkpoint.save").touch()Checkpoint saves within the next check_interval steps. The trigger file is auto-deleted after detection, so you can create it multiple times.
Custom filename:
dynamic_checkpoint:
enabled: true
trigger_file_path: "my_trigger.save"touch /path/to/output_dir/my_trigger.save4 Retrying Saves After Disk Errors
A checkpoint write that fails because the disk is full, a quota is exceeded, or the filesystem
returns an I/O error normally fails the save and ends training. With checkpoint_save_retry,
the write waits and is tried again first:
checkpoint_save_retry:
wait_seconds: 300 # pause before rewriting the file
retries: 1 # retries per file before the error is raisedThe retry applies to the files of each checkpoint-N: model weights, optimizer, scheduler and
RNG states, the trainer state, and the model, adapter, generation and tokenizer configs. The
failed file is rewritten in place on the rank that hit the error, so no rank skips or reorders a
collective. The other ranks wait at their next collective,
so keep wait_seconds * retries below ddp_timeout (1800 seconds by default); Axolotl warns at
startup otherwise. Distributed checkpoint saves (FSDP sharded state dicts) report a failure on
every rank, and every rank retries them together.
Disk errors are recognized by errno (ENOSPC, EDQUOT, EIO, EFBIG, ESTALE) and by the
messages that writers without an errno produce, for example
I/O error: Disk quota exceeded (os error 122) from safetensors or file write failed from
torch.save. Other errors are raised immediately. When checkpoint_mirror is also set, the
pause gives queued copies time to finish and release the local disk space they hold.
5 Control+C (SIGINT) Checkpoint
Pressing Ctrl+C during training saves the model state and exits gracefully. Note: This saves only the model weights, not optimizer state. For resumable checkpoints, use the file-based trigger.
6 Best Practices
- Check interval: Lower values (10-50) for fast training, higher values (e.g. 100) for slower training
- Distributed training: Create trigger file once; rank 0 handles synchronization
- Resume: Dynamic checkpoints can be resumed like regular checkpoints via
resume_from_checkpoint
7 Example
output_dir: ./outputs/lora-out
save_steps: 500 # Scheduled checkpoints
dynamic_checkpoint:
enabled: true
check_interval: 50This enables scheduled checkpoints every 500 steps plus on-demand saves via file trigger (checked every 50 steps).