AGENT SKILL

customization-extension

Extend nnU-Net v2 with custom trainers, planners, preprocessors, normalization, image IO, label/region handling, external trainer deployment, and safe class discovery.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
customization-extension
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Extend nnU-Net v2 with custom trainers, planners, preprocessors, normalization, image IO, label/region handling, external trainer deployment, and safe class discovery.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

nnU-Net v2 Customization and Extension

Use this sub-skill when the task is to change nnU-Net behavior by adding or selecting custom Python classes rather than only running standard workflows.

Route here for

  • Implementing or selecting custom nnUNetTrainer subclasses for loss, sampling, augmentation, optimizer, scheduler, checkpoint, or network changes.
  • Making custom trainers portable for inference or continued training through checkpoint rename, nnUNet_extTrainer, editable source placement, or a fork.
  • Implementing custom ExperimentPlanner, DefaultPreprocessor subclasses, resampling behavior, normalization classes, or image reader/writers.
  • Understanding class discovery by name for trainers, planners, preprocessors, normalization schemes, label managers, and reader/writers.
  • Diagnosing trainer/planner/preprocessor/reader class not found, external trainer import errors, or old custom trainer API signatures.
  • Designing label/region/ignore-label behavior only when it affects custom code or extension compatibility.

Do not handle here

  • Dataset folder layout, dataset.json basics, file naming, and routine region/ignore-label authoring: use data-preparation.
  • Running planning/preprocessing commands or deciding routine reruns: use planning-preprocessing.
  • Routine training command matrices, folds, resume, validation, or selecting a built-in trainer by name: use training-configuration.
  • Inference, ensembling, evaluation, pretrained model import/export, or model use: use inference-evaluation.

Fast path

  1. Identify the extension point and the class name nnU-Net will resolve: trainer, planner, preprocessor, normalization scheme, image reader/writer, label manager, or network architecture.
  2. Prefer subclassing an existing nnU-Net implementation and overriding the smallest method needed.
  3. If the extension changes preprocessing output, use a distinct plans name or data_identifier and rerun planning/preprocessing for affected configurations.
  4. For custom trainers used outside the development environment, choose a sharing strategy before distributing checkpoints.
  5. Before running expensive jobs, list available classes with the bundled read-only helper:
    python sub-skills/customization-extension/scripts/list_available_nnunet_classes.py --kind trainer
    
  6. If a class is external, set nnUNet_extTrainer for trainer lookup or install/place source code so normal Python imports work.

Bundled references

  • references/extension-points.md: extension hook map, class names, plan fields, dataset metadata interactions, and discovery rules.
  • references/custom-trainers-and-sharing.md: trainer subclass patterns and model-sharing choices for custom trainers.
  • references/troubleshooting.md: lookup, import, API-signature, sharing, image IO, normalization, region, and ignore-label failures.

Bundled helper

list_available_nnunet_classes.py imports nnU-Net and prints discovered class names without modifying files, checkpoints, plans, or environment variables. It can inspect built-in locations and optional external trainer roots:

python sub-skills/customization-extension/scripts/list_available_nnunet_classes.py --kind all
python sub-skills/customization-extension/scripts/list_available_nnunet_classes.py --kind trainer --external-trainer-dir /path/to/trainers

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351