Checkpointing and Tracking
Use this sub-skill when the task involves Accelerate checkpoint save/load, model export, tracker initialization/logging, distributed-safe logging, profiling, state/RNG handling, or memory cleanup around those workflows.
Route First
- For the core forward/backward/optimizer loop, gradient accumulation, prepared dataloaders, and
skip_first_batches, use ../training-loop-integration/.
- For FSDP, DeepSpeed, Megatron-LM, or backend-specific checkpoint strategy and consolidation details, use
../distributed-training-backends/.
- For large-model dispatch/offload checkpoint loading, route to the large-model or big-modeling sub-skill if present.
Fast Workflows
- Save and resume same-script training state with
Accelerator.save_state() and Accelerator.load_state(); see references/checkpointing.md.
- Configure automatic checkpoint folders and retention with
ProjectConfiguration; see references/checkpointing.md.
- Register custom checkpointable objects and save/load pre-hooks for extra metadata; see
references/checkpointing.md.
- Initialize trackers with
Accelerator(log_with=...), init_trackers(), log(), get_tracker(), and end_training(); see references/tracking-and-logging.md.
- Use
accelerate.logging.get_logger() for multiprocess-safe logs and ordered rank logs; see references/tracking-and-logging.md.
- Profile CPU/GPU/XPU sections with
ProfileKwargs and accelerator.profile(); see references/tracking-and-logging.md.
- Diagnose common failures using
references/troubleshooting.md before changing training code.
Bundled Helper
- Run
python scripts/checkpoint_tracker_smoke.py --help for usage.
- Run
python scripts/checkpoint_tracker_smoke.py to verify a CPU-only tiny save/load/custom-tracker/logging smoke test without any external tracker service.
Key Constraints
save_state()/load_state() are for resuming the same training script shape, not arbitrary model conversion between unrelated scripts.
- Register custom objects only if they implement both
state_dict() and load_state_dict().
- For ordinary model artifact export, prefer
accelerator.unwrap_model(), accelerator.get_state_dict(), accelerator.save(), or accelerator.save_model() rather than treating a training-state checkpoint as a deployment artifact.
1---2name: checkpointing-and-tracking3description: "Save and resume Accelerate training state, register checkpoint4 hooks and custom state, log safely across processes, use experiment trackers,5 profile runs, and clean up memory."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/checkpointing-and-tracking9 disco-role: operating10license: Apache 2.011---1213# Checkpointing and Tracking1415Use this sub-skill when the task involves Accelerate checkpoint save/load, model export, tracker initialization/logging, distributed-safe logging, profiling, state/RNG handling, or memory cleanup around those workflows.1617## Route First1819- For the core forward/backward/optimizer loop, gradient accumulation, prepared dataloaders, and `skip_first_batches`, use `../training-loop-integration/`.20- For FSDP, DeepSpeed, Megatron-LM, or backend-specific checkpoint strategy and consolidation details, use `../distributed-training-backends/`.21- For large-model dispatch/offload checkpoint loading, route to the large-model or big-modeling sub-skill if present.2223## Fast Workflows2425- Save and resume same-script training state with `Accelerator.save_state()` and `Accelerator.load_state()`; see `references/checkpointing.md`.26- Configure automatic checkpoint folders and retention with `ProjectConfiguration`; see `references/checkpointing.md`.27- Register custom checkpointable objects and save/load pre-hooks for extra metadata; see `references/checkpointing.md`.28- Initialize trackers with `Accelerator(log_with=...)`, `init_trackers()`, `log()`, `get_tracker()`, and `end_training()`; see `references/tracking-and-logging.md`.29- Use `accelerate.logging.get_logger()` for multiprocess-safe logs and ordered rank logs; see `references/tracking-and-logging.md`.30- Profile CPU/GPU/XPU sections with `ProfileKwargs` and `accelerator.profile()`; see `references/tracking-and-logging.md`.31- Diagnose common failures using `references/troubleshooting.md` before changing training code.3233## Bundled Helper3435- Run `python scripts/checkpoint_tracker_smoke.py --help` for usage.36- Run `python scripts/checkpoint_tracker_smoke.py` to verify a CPU-only tiny save/load/custom-tracker/logging smoke test without any external tracker service.3738## Key Constraints3940- `save_state()`/`load_state()` are for resuming the same training script shape, not arbitrary model conversion between unrelated scripts.41- Register custom objects only if they implement both `state_dict()` and `load_state_dict()`.42- For ordinary model artifact export, prefer `accelerator.unwrap_model()`, `accelerator.get_state_dict()`, `accelerator.save()`, or `accelerator.save_model()` rather than treating a training-state checkpoint as a deployment artifact.