training-evaluation
Train, evaluate, checkpoint, and troubleshoot Detectron2 models with safe commands and APIs.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-evaluation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Train, evaluate, checkpoint, and troubleshoot Detectron2 models with safe commands and APIs.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/evaluation-checkpointing.md5.3 KB
- 参考文档references/training-workflows.md9.1 KB
- 参考文档references/troubleshooting.md6.2 KB
- 脚本scripts/evaluation_plan.py4.9 KB
- 脚本scripts/train_command_builder.py4.9 KB
03 SKILL.md 正文
Detectron2 Training & Evaluation
Use this sub-skill when the task is to run or prepare Detectron2 training/evaluation, customize trainers/hooks/evaluators/checkpointing, or diagnose training/eval failures. It assumes datasets and configs have already been selected or registered by the dataset/configuration sub-skills.
Fast Routing
- Build safe training/eval commands with
scripts/train_command_builder.py; it prints commands only and never starts training. - Plan evaluator/checkpoint setup with
scripts/evaluation_plan.py; it prints checks and next steps only and never runs evaluation. - Read
references/training-workflows.mdfor standard Detectron2 train/eval driver semantics,DefaultTrainer,SimpleTrainer, hooks, launch, solver scaling, and resume/eval-only behavior. - Read
references/evaluation-checkpointing.mdfor evaluator selection,inference_on_dataset,verify_results,DetectionCheckpointer, and checkpoint loading/resume behavior. - Read
references/troubleshooting.mdbefore starting long jobs, changing GPU count, using a custom dataset, switching Yacs/LazyConfig syntax, or debugging failed evaluation.
Safe Defaults
- Prefer a dry-run command/planning step before running a long job; stop for user approval when training would be long, multi-GPU, dataset-heavy, or hardware-dependent.
- Use a project-local driver with the standard Detectron2 parser shape:
python PROJECT_TRAIN_DRIVER.py --config-file CONFIG --num-gpus N [--resume|--eval-only] KEY VALUE .... - Use LazyConfig syntax only for Python config files:
python PROJECT_LAZY_TRAIN_DRIVER.py --config-file CONFIG.py train.output_dir=... dataloader.train.total_batch_size=.... - Do not use the repository demo CLI as a runtime dependency; in this checkout its demo imports a missing
vision.fair.detectron2.demo.predictormodule.
Common APIs
- Yacs training: subclass
DefaultTrainer, overridebuild_evaluator, optionally overridebuild_train_loader,build_optimizer,build_lr_scheduler, or register hooks. - Minimal loop: use
SimpleTrainer(model, data_loader, optimizer)whenDefaultTrainerassumptions are too restrictive. - Distributed entry: call
launch(main_func, num_gpus_per_machine, num_machines=1, machine_rank=0, dist_url=None, args=()). - Evaluation: use
COCOEvaluator,SemSegEvaluator,DatasetEvaluator,DatasetEvaluators, andinference_on_dataset(model, data_loader, evaluator). - Checkpointing: use
DetectionCheckpointer(model, save_dir, trainer=trainer)and distinguishload,resume_or_load,--resume, and--eval-only.
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).