model-inference
Construct, inspect, and troubleshoot SSD300 model inference internals for the ssd.pytorch repository.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-inference
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Construct, inspect, and troubleshoot SSD300 model inference internals for the ssd.pytorch repository.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/inference-workflow.md5.4 KB
- 参考文档references/model-api.md6.6 KB
- 参考文档references/troubleshooting.md5.4 KB
- 脚本scripts/check_box_utils.py4.5 KB
- 脚本scripts/inspect_model_shapes.py4.7 KB
03 SKILL.md 正文
model-inference
Use this sub-skill when a task needs to construct or inspect the SSD300 model, its prior boxes, multibox heads, detection decode/NMS path, single-image inference preprocessing, or pretrained weight compatibility.
When to use
- Build or inspect
build_ssd(phase, size=300, num_classes=21). - Explain the VGG base, extra layers, L2 normalization, localization heads, confidence heads, prior boxes, decode, and NMS contracts.
- Diagnose model construction, state-dict loading, class-count/head mismatches, tensor shape/device issues, or the legacy
Detectincompatibility on modern PyTorch. - Plan safe single-image inference preprocessing and postprocessing without overclaiming that test-phase inference works unchanged on modern PyTorch.
Route elsewhere
- Dataset roots, VOC/COCO layout, annotation transforms, augmentation, dataloaders, and training commands:
../data-training/SKILL.md. eval.py,test.py, notebook demo, webcam demo, VOC result files, and runnable evaluation/demo command workflows:../evaluation-demos/SKILL.md.
Start here
- Read
references/model-api.mdfor signatures, model components, config facts, tensor shapes, and output contracts. - Read
references/inference-workflow.mdbefore loading weights or performing single-image inference; it includes the safe construction path and the modern PyTorch detection-layer decision point. - Read
references/troubleshooting.mdwhen imports, phases, state dicts, devices, or test-phase forward passes fail. - Use the bundled scripts for focused, low-cost checks:
python scripts/inspect_model_shapes.py --num-classes 21
python scripts/inspect_model_shapes.py --num-classes 21 --phase train --run-forward
python scripts/check_box_utils.py
The scripts assume they are run from a checkout or environment where the repository source modules are importable. They do not download data or weights.
Do not overclaim
build_ssd('train', 300, 21)constructs and train-phase zero forward has been observed to return(loc, conf, priors)with shapes(1, 8732, 4),(1, 8732, 21),(8732, 4)under a modern Torch runtime, aside from aVariable(..., volatile=True)warning.build_ssd('test', ...)constructs the legacy detection module, but a forward pass can fail on modern PyTorch becauseDetectsubclassestorch.autograd.Functionwith an old-style instanceforward. PatchDetector use a legacy-compatible PyTorch before claiming end-to-end inference/eval works.- Importing
ssdordatamay fail before model construction if the COCO label-map default path is absent; see troubleshooting for safe remedies.
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).