checkpointing-and-tracking
Save and resume Accelerate training state, register checkpoint hooks and custom state, log safely across processes, use experiment trackers, profile runs, and clean up memory.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- checkpointing-and-tracking
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Save and resume Accelerate training state, register checkpoint hooks and custom state, log safely across processes, use experiment trackers, profile runs, and clean up memory.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md8.5 KB
- 参考文档references/checkpointing.md7.2 KB
- 参考文档references/tracking-and-logging.md7.6 KB
- 参考文档references/troubleshooting.md8.4 KB
- 脚本scripts/checkpoint_tracker_smoke.py8.5 KB
03 SKILL.md 正文
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()andAccelerator.load_state(); seereferences/checkpointing.md. - Configure automatic checkpoint folders and retention with
ProjectConfiguration; seereferences/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(), andend_training(); seereferences/tracking-and-logging.md. - Use
accelerate.logging.get_logger()for multiprocess-safe logs and ordered rank logs; seereferences/tracking-and-logging.md. - Profile CPU/GPU/XPU sections with
ProfileKwargsandaccelerator.profile(); seereferences/tracking-and-logging.md. - Diagnose common failures using
references/troubleshooting.mdbefore changing training code.
Bundled Helper
- Run
python scripts/checkpoint_tracker_smoke.py --helpfor usage. - Run
python scripts/checkpoint_tracker_smoke.pyto 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()andload_state_dict(). - For ordinary model artifact export, prefer
accelerator.unwrap_model(),accelerator.get_state_dict(),accelerator.save(), oraccelerator.save_model()rather than treating a training-state checkpoint as a deployment artifact.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).