architecture-api
Inspect and modify D-FINE architecture, registry, YAMLConfig, model components, deploy mode, and API behavior.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- architecture-api
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Inspect and modify D-FINE architecture, registry, YAMLConfig, model components, deploy mode, and API behavior.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md5.6 KB
- 参考文档references/model-architecture.md5.2 KB
- 参考文档references/troubleshooting.md3.9 KB
- 脚本scripts/inspect_dfine_model.py7.8 KB
03 SKILL.md 正文
D-FINE Architecture and API Router
Use this sub-skill when a task is about D-FINE internals rather than just running a training or inference command: YAML registry construction, component names in configs, model assembly, D-FINE decoder behavior, deploy mode, criterion/postprocessor APIs, checkpoint shape mismatches, or adding a custom component.
Route here for
- Explaining how
YAMLConfig,GLOBAL_CONFIG,register(), andcreate()turn YAMLtypenames into Python objects. - Inspecting model components such as
DFINE,HGNetv2,HybridEncoder,DFINETransformer,DFINECriterion,HungarianMatcher, andDFINEPostProcessor. - Diagnosing
The module ... is not registered,Missing inject config, invalidtypeentries, or component channel/stride mismatches. - Understanding deploy-mode conversion before ONNX export or inference.
- Planning code changes for a new backbone, encoder, decoder, criterion, matcher, postprocessor, optimizer, transform, dataset, or evaluator.
- Checking a config/model safely with
scripts/inspect_dfine_model.pybefore long training or export.
Route away
- Dataset paths, COCO/custom annotation schemas,
num_classes,remap_mscoco_category, and YAML catalog selection: use ../data-and-configs/SKILL.md. - Training,
--test-only, resume, tuning, DDP, AMP, EMA, or output directories: use ../training-evaluation/SKILL.md. - PyTorch/ONNX/OpenVINO/TensorRT inference, export, and benchmark commands: use ../inference-export/SKILL.md.
First actions
- Read references/api-reference.md for verified signatures, registry semantics, and component relationships.
- Read references/model-architecture.md when the task asks about D-FINE, FDR/GO-LSD-related knobs, model sizes, deploy mode, or component responsibilities.
- Run
python scripts/inspect_dfine_model.py --repo-root <d-fine-checkout> --config <config.yml> --build-modelfor a safe import/config/model probe. Add--allow-pretrainedonly when the user wants pretrained backbone lookup/download behavior. - For errors, use references/troubleshooting.md before editing code or config.
Safety and evidence rules
- Disable HGNetv2 pretrained lookup for inspection unless the user explicitly wants to test pretrained weight availability.
- Treat config keys and registered class names as case-sensitive.
- Prefer inspecting config construction and parameter counts before attempting a dummy forward; full forward, training, or evaluation can be slow and data/backend dependent.
- When adding a component, update both the Python registration/import path and the YAML
type/injection references that select it.
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).