training-workflows
Compose timm API-level training loops with optimizer and scheduler factories, loss selection, task wrappers, EMA, AMP scaling, metrics, checkpoint state, and safe CPU smoke checks. Use when writing or debugging custom training code rather than cataloging train.py CLI flags or building data loaders.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-workflows
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Compose timm API-level training loops with optimizer and scheduler factories, loss selection, task wrappers, EMA, AMP scaling, metrics, checkpoint state, and safe CPU smoke checks. Use when writing or debugging custom training code rather than cataloging train.py CLI flags or building data loaders.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/optimizer-scheduler-guide.md7.2 KB
- 参考文档references/training-api.md7.2 KB
- 参考文档references/troubleshooting.md6.1 KB
- 脚本scripts/training_api_smoke.py5.2 KB
03 SKILL.md 正文
Training Workflows
Use this sub-skill when an agent needs to assemble or debug timm training components in Python code: create_optimizer_v2, optimizer_kwargs, create_scheduler_v2, loss modules, task wrappers, EMA, AMP scaling, metrics, and checkpoint-saving concepts.
Route by Need
- Optimizer or parameter groups: Start with
references/optimizer-scheduler-guide.mdforcreate_optimizer_v2, weight-decay filtering, layer decay, hybrid fallback groups, andoptimizer_kwargsconfig translation. - LR schedule behavior: Use
references/optimizer-scheduler-guide.mdforcreate_scheduler_v2, epoch-vs-update stepping, warmup, cycles, plateau metrics, and returned adjusted epoch counts. - Losses and task wrappers: Use
references/training-api.mdforLabelSmoothingCrossEntropy,SoftTargetCrossEntropy,BinaryCrossEntropy,JsdCrossEntropy,ClassificationTask, and distillation task routing. - EMA, AMP, metrics, checkpoints: Use
references/training-api.mdforModelEmavariants,NativeScaler,accuracy,AverageMeter, task checkpoint state, andCheckpointSaverconcepts. - Failure diagnosis: Use
references/troubleshooting.mdfor unsupported optimizer names, layer-decay grouping, scheduler step confusion, mixup/BCE target shape, distillation shape mismatches, EMA resume, and AMP/device mismatch. - Smoke construction: Run or adapt
scripts/training_api_smoke.pyto verify a model, optimizer, scheduler, loss, optional task wrapper, metrics, EMA, and one CPU backward pass.
Boundaries
- This sub-skill covers API-level composition. Leave train script flag catalogs and launch recipes to
cli-workflows. - This sub-skill assumes tensors already come from a valid pipeline. Leave dataset, loader, transforms, mixup/cutmix construction, and collation details to
data-pipelines. - Do not make generated examples depend on repository-local files; keep examples importable from installed
timmand standard PyTorch.
Safe Defaults
For a minimal custom loop, prefer create_model(..., pretrained=False), create_optimizer_v2(model, opt='adamw', lr=...), create_scheduler_v2(optimizer, sched='cosine', num_epochs=..., warmup_epochs=...), a target-compatible loss, accuracy/AverageMeter for logging, and optional ModelEmaV3 after model/device placement.
Run the smoke script before recommending a larger recipe:
python scripts/training_api_smoke.py --model resnet18 --opt adamw --sched cosine
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).