sdk
Use MMDeploy SDK model directories, runtime FFIs, profiler output, and packaged SDK distributions for inference.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sdk
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use MMDeploy SDK model directories, runtime FFIs, profiler output, and packaged SDK distributions for inference.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/model-directory.md6.0 KB
- 参考文档references/profiler-and-packaging.md6.8 KB
- 参考文档references/sdk-workflows.md7.6 KB
- 参考文档references/troubleshooting.md15.6 KB
- 脚本scripts/sdk_analyze.py10.1 KB
03 SKILL.md 正文
MMDeploy SDK Router
Use this sub-skill when the user already has, or needs to consume, an MMDeploy
SDK model directory produced with --dump-info; when they ask how to run
mmdeploy_runtime from Python; when they need C, C++, Java, or C# SDK inference
patterns; when they have SDK profiler output; or when they need safe guidance on
precompiled SDK/runtime packages.
Do not use this sub-skill for conversion internals, deployment config authoring, backend toolkit installation, custom-op builds, regression automation, or metric benchmarking. Route those tasks to the owning conversion, backend, extensibility, or validation guidance, and return here only for the SDK model directory/runtime handoff.
Read These First
- SDK workflows —
--dump-infohandoff, Python and C/C++ API patterns, language demo coverage, and FFI task mapping. - Model directory — required JSON files, backend artifacts, zip-model support, and validation checks for SDK model packages.
- Profiler and packaging — SDK profiler data format, bundled analyzer usage, precompiled package concepts, and safe packaging caveats.
- Troubleshooting — symptoms, likely causes, recovery steps, and stop conditions for SDK runtime failures.
- SDK profile analyzer — read-only analyzer for SDK profiler text files.
Route The User Request
-
Clarify the artifact. SDK runtime APIs consume a model directory or a zip model built for SDK loading. A raw backend file such as
end2end.engine,end2end.onnx,end2end.xml, orend2end.paramis not enough formmdeploy_runtimetask classes because preprocessing and postprocessing live in the SDK metadata JSON files. -
Check the model package before writing runtime code. At minimum, the directory should contain
deploy.json,pipeline.json,detail.json, and every backend file named bydeploy.json. Use Model directory for a deterministic checklist. -
Pick the runtime FFI from the user environment.
- Python: import
mmdeploy_runtimeand create the appropriate task class, usuallyDetector,Classifier,Segmentor,Restorer,TextDetector,TextRecognizer,PoseDetector,RotatedDetector, orVideoRecognizer. - C: create a model or task handle, convert input images to
mmdeploy_mat_t, call*_apply, release results, and destroy handles. - C++: use
mmdeploy::Model,mmdeploy::Deviceormmdeploy::Context, then constructmmdeploy::<Task>and callApply. - Java/C#: instantiate the generated task wrapper with
(modelPath, deviceName, deviceId)and keep required native libraries discoverable.
- Python: import
-
Interpret device arguments literally. Python runtime constructors take a
device_namesuch as"cpu"or"cuda"plus a numericdevice_id. Do not pass a converter-stylebackend_fileslist to SDK task classes, and do not pass only an engine file asmodel_path. -
For profiler questions, route directly to the analyzer. If the file is a text SDK profile with a graph section, a
----separator, and event lines, run:python scripts/sdk_analyze.py profiler_data.txtThen use Profiler and packaging to interpret
occupy,usage,n_call,t_mean,t_50%, andt_90%. -
For precompiled package questions, distinguish usage from release builds. Installing an existing runtime wheel/package is a user workflow. Building release packages is a maintainer workflow that depends on Python ABI, platform, device, backend libraries, CMake flags, and licensing constraints.
Minimal SDK Runtime Checks
Use these only as read-only probes; they do not prove a backend engine is valid:
python - <<'PY'
import importlib.util
print('mmdeploy_runtime:', importlib.util.find_spec('mmdeploy_runtime') is not None)
PY
from mmdeploy.backend.sdk import is_available
print(is_available()) # True only when the Python SDK runtime module is visible
If either check is false, do not continue with SDK inference code until the runtime package or built SDK Python API is available.
Boundaries And Handoffs
- If
--dump-infowas omitted or the SDK JSON files are missing, hand the user back to conversion guidance to regenerate the model directory with SDK info. - If
mmdeploy_runtimeimports but backend shared libraries or device runtimes are missing, use backend guidance for the target backend/device before trying another API layer. - If the user asks for model accuracy, dataset metrics, latency benchmarking, or regression matrix automation, use validation guidance. This route only covers SDK inference and SDK profiler interpretation.
- If the user asks to modify converters, rewrite transforms, or add new SDK task support, use extensibility guidance; this route only consumes the emitted SDK package.
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).