界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

cnn-model-building

cnn-model-building

【效率与协作】Build CPU-safe PyTorch CNN layers and model helpers with MMCV builders, module bundles, wrappers, plugins, transformers, and complexity utilities.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: cnn-model-building description: "Build CPU-safe PyTorch CNN layers and model helpers with MMCV builders, module bundles, wrappers, plugins, transformers, and complexity utilities." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

MMCV CNN Model Building

Use this sub-skill when a task needs MMCV's PyTorch-dependent CNN construction helpers: config-style layer builders, ConvModule, depthwise separable blocks, wrapper layers, plugin blocks, transformer bricks, model complexity checks, or small ResNet/VGG helper layers.

Do not use this sub-skill for compiled CUDA/C++ ops installation or mmcv.ops runtime failures; route those to ops-and-builds. Do not use it for image preprocessing or data transforms; route those to media-processing or data-transforms.

Quick Workflow

  1. Confirm torch and mmcv import before using mmcv.cnn; MMCV Lite can build pure PyTorch CNN layers but does not provide compiled mmcv._ext ops.
  2. Choose the smallest builder: build_conv_layer, build_norm_layer, build_activation_layer, build_padding_layer, build_upsample_layer, or build_plugin_layer.
  3. Prefer ConvModule for conv/norm/activation bundles and explicitly set norm_cfg, act_cfg, bias, and order when matching existing PyTorch behavior.
  4. Use DepthwiseSeparableConvModule, ContextBlock, NonLocal*, Scale, wrappers, fuse_conv_bn, and get_model_complexity_info only where their assumptions match the model.
  5. For custom layers, register with mmengine.registry.MODELS before building from config.
  6. Run the bundled smoke helper after edits or environment changes:
python scripts/cnn_builder_smoke.py

References

  • API Reference: builder signatures, supported config type values, return conventions, and module parameters.
  • Workflows: recipes for layer configs, ConvModule migration, registry extension, fusion, complexity, and CPU-safe transformer bricks.
  • Troubleshooting: common config, torch, registry, shape, bias, order, plugin, and optional-ops failures.
我的收藏