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

model-task-adaptation

model-task-adaptation

【效率与协作】Routes pytorch-grad-cam adaptation for ViT, Swin, CLIP, object detection, semantic segmentation, embeddings, custom targets, and reshape transforms.

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

技能说明

GitHub

name: model-task-adaptation description: "Routes pytorch-grad-cam adaptation for ViT, Swin, CLIP, object detection, semantic segmentation, embeddings, custom targets, and reshape transforms." disable-model-invocation: true metadata: disco-role: operating license: MIT

Model and Task Adaptation

Use this sub-skill when the model output or intermediate activation is not an ordinary CNN feature map plus classification logits. It covers transformer token reshaping, CLIP prompt scoring, HuggingFace/timm optional dependencies, object detection and segmentation targets, embeddings/similarity outputs, and custom callables.

Read first

Adaptation contract

  1. Identify the tensor or structured output whose scalar should be explained.
  2. Write a target callable that reduces that output to one scalar per batch item.
  3. Identify the activation shape at the chosen target layer.
  4. If it is not already spatial B x C x H x W, pass a reshape_transform that removes non-spatial tokens and transposes to channel-first layout.
  5. Verify output shapes and device/dtype behavior with synthetic tensors before downloading external models or running expensive examples.

Do not select a final transformer block blindly: if the classifier reads only a class token, patch gradients at the final block can be zero. Use the nearest pre-head spatially meaningful layer and validate it.

我的收藏