runner-and-training
Build, adapt, and troubleshoot MMEngine Runner and FlexibleRunner training workflows, hooks, optimizers, schedulers, checkpoints, resume, distributed launch, and optional strategies.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- runner-and-training
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build, adapt, and troubleshoot MMEngine Runner and FlexibleRunner training workflows, hooks, optimizers, schedulers, checkpoints, resume, distributed launch, and optional strategies.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/hooks-optim-schedulers.md7.1 KB
- 参考文档references/large-model-and-distributed.md6.4 KB
- 参考文档references/runner-workflows.md7.8 KB
- 参考文档references/troubleshooting.md8.7 KB
- 脚本scripts/runner_config_smoke.py12.6 KB
03 SKILL.md 正文
Runner and Training
Use this sub-skill when a task mentions Runner.from_cfg, Runner, FlexibleRunner, train_cfg, val_cfg, test_cfg, hooks, checkpoints, resume, AMP, gradient accumulation, parameter schedulers, distributed launch, or large-model strategies.
Read Order
- references/runner-workflows.md: Assemble
RunnerandFlexibleRunnerconfigs, choose train/val/test loops, handle checkpoint/resume semantics, and understand runtime outputs. - references/hooks-optim-schedulers.md: Configure default/custom hooks, checkpoint best metrics,
OptimWrapper/AmpOptimWrapper, gradient accumulation, clipping, and parameter schedulers. - references/large-model-and-distributed.md: Choose launchers, distributed backends,
FlexibleRunnerstrategies, AMP/compile/checkpointing, and dependency-gated DeepSpeed/FSDP/ColossalAI paths. - references/troubleshooting.md: Diagnose common Runner, hook, optimizer, scheduler, checkpoint, resume, launcher, and strategy failures by symptom.
- scripts/runner_config_smoke.py: Safely validate Runner-like JSON config shape without importing project code, downloading data, launching distributed jobs, or training.
Scope
This sub-skill owns MMEngine training orchestration: mmengine.runner, mmengine.hooks, mmengine.optim, mmengine._strategy, training/validation/testing loops, checkpointing, resume/load behavior, randomness, log processors, distributed launch recipes, and optional strategy configs.
Route adjacent issues to sibling skills:
- Use
../configuration-and-registry/SKILL.mdfor Python/YAML config syntax,_base_, custom imports, registry scopes, andbuild_from_cfgfailures. - Use
../models-metrics-and-inference/SKILL.mdforBaseModel.forward,train_step,val_step, evaluator, metric, TTA, and prediction contracts. - Use
../data-structures-and-io/SKILL.mdfor dataset, sampler, collate, data element, annotation, and file IO details. - Use
../runtime-utilities-and-visualization/SKILL.mdfor visualizer backends, logger internals, message hubs, device utilities, and general distributed helpers outside Runner orchestration.
Fast Workflow
- Identify the entry point:
Runner.from_cfg(cfg)for config-driven projects, directRunner(...)for small experiments, orFlexibleRunner(...)whenstrategy,compile, or large-model training is central. - Check loop completeness: training needs
model,work_dir,train_dataloader,train_cfg, andoptim_wrapper; validation/testing additionally need matching dataloaders, loop cfgs, and evaluators. - Align time units: if
train_cfg.by_epoch=False, also aligndefault_hooks.checkpoint.by_epoch,default_hooks.logger.log_metric_by_epoch,log_processor.by_epoch, and schedulerby_epochorconvert_to_iter_basedsettings. - Decide checkpoint semantics:
load_fromwithoutresume=Trueloads weights only;resume=Truerestores optimizer and scheduler state from the latest or specified checkpoint. - Validate risky edits from this sub-skill directory with
python scripts/runner_config_smoke.py --config-json config.jsonafter converting the relevant config shape to JSON.
Output Expectations
Runner.train() returns the trained model, while Runner.val() and Runner.test() return metric dictionaries. Runtime outputs normally include checkpoints, logs, and visualizer files under the configured work_dir or log directory; this sub-skill treats those as user project outputs, not managed skill files.
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).