Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
backends【部署与运维】Select, install, check, and troubleshoot MMDeploy inference backends, custom ops, and backend manager availability.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task is about choosing an MMDeploy backend, installing
backend packages or vendor toolkits, checking BackendManager availability,
building backend custom ops, or recovering from backend-specific failures.
Do not use this sub-skill to orchestrate full model conversion, SDK demo usage, or regression benchmarking. For those workflows, keep this sub-skill responsible only for backend readiness and failure diagnosis, then route the actual conversion, SDK runtime, or validation flow to the owning route.
libpython, TorchScript ABI/cuDNN, vendor toolkits, SDK runtime, config, and
API misuse.Identify the target artifact and device.
.param/.bin mobile or embedded CPU artifacts: NCNN..xml/.bin) on Intel CPU-oriented deployments: OpenVINO..pt artifacts or LibTorch SDK backend: TorchScript.mmdeploy_runtime model directories and wrappers: SDK backend manager.Check backend availability before trying conversion. Run the bundled checker from this sub-skill:
python scripts/check_env.py --backend tensorrt --with-custom-ops
python scripts/check_env.py --backend onnxruntime --backend ncnn --json
When the package is installed but custom ops are missing, read Custom ops before rebuilding anything.
Inspect the deployment config shape. The relevant key is always
backend_config.type; backend-specific details live under
backend_config.common_config, backend_config.model_inputs,
quantization fields, or Model Optimizer options. TensorRT dynamic profiles
must include coherent min_shape, opt_shape, and max_shape values for
every runtime input name.
Install only the backend stack required by the selected target. Do not install all optional backends. Prefer Python package/import checks first, then vendor toolkit and CMake/build checks only when SDK runtime or custom ops are required.
Stop instead of guessing when a proprietary toolkit, hardware device, driver, cross-compiler, service URI, or SDK runtime is absent and no CPU substitute is available.
Use manager checks when diagnosing availability or conditional API exports:
from mmdeploy.backend.base import get_backend_manager
manager = get_backend_manager('tensorrt')
print(manager is not None)
print(manager.is_available())
print(manager.is_available(with_custom_ops=True))
print(manager.get_version())
Important interpretation rules:
is_available() usually means the Python package or required converter tool
can be found; it does not prove custom ops, SDK runtime, or accelerator
hardware work.is_available(with_custom_ops=True) is stricter for ONNXRuntime,
TensorRT, NCNN, and TorchScript. It can be False even when the backend
package itself is available.from mmdeploy.apis.tensorrt import onnx2tensorrt may be absent even though is_available itself can still be
imported.onnx2dlc tool path; version
reporting is not implemented by its manager.python scripts/check_env.py --backend <name>.python scripts/check_env.py --backend <name> --with-custom-ops and use
Custom ops to build the backend plugin only for
that backend.onnx2* converter
wrappers.mmdeploy_runtime model execution are
owned by the SDK route. This sub-skill only checks SDK backend-manager
availability and explains missing runtime symptoms.