pretraining-and-adaptation
Routes vit-pytorch loss wrappers, self-supervised pretraining helpers, distillation, and adaptation or fine-tuning flows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pretraining-and-adaptation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Routes vit-pytorch loss wrappers, self-supervised pretraining helpers, distillation, and adaptation or fine-tuning flows.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/troubleshooting.md9.3 KB
- 参考文档references/workflows.md11.8 KB
- 脚本scripts/smoke_pretraining_wrappers.py16.7 KB
03 SKILL.md 正文
pretraining-and-adaptation
Use this sub-skill when the user asks how to build or smoke-test vit-pytorch loss-based wrappers, self-supervised learners, distillation flows, or adaptation heads. The goal is to route to the right wrapper, identify expected inputs and outputs, and surface version/dependency pitfalls before a user starts a long training run.
Read first
- Read references/workflows.md for wrapper roles, tiny construction patterns, expected input/output shapes, and which helpers return logits versus scalar losses.
- Read references/troubleshooting.md when a wrapper fails during construction, hook registration, augmentation, optional dependency import, checkpoint loading, or the first loss backward pass.
- Run scripts/smoke_pretraining_wrappers.py
to check the installed package with tiny CPU random tensors. The helper
reports
verified,version_fragile,dependency_gap, andunexpected_failurestatuses.
Route here for
DistillableViT,DistillableT2TViT,DistillableEfficientViT, andDistillWrapperone-step teacher/student distillation.- Masked-image or masked-position pretraining:
MAE,SimMIM,MPP, andMP3. - Self-supervised crop/view learners:
Dino,EsViTTrainer, andLeJEPA. - Adaptation/fine-tuning helpers: Learnable Memory ViT
Adapter, VAT, SigLIP-VAT, optional VAAT, WWT, andvit_with_decorr.ViT. - Questions like “does this wrapper still work after upgrading?”, “can I run a one-step loss check on random tensors?”, and “what dependencies do I need for this adaptation flow?”
Do not route here for
- Plain image backbone selection with no pretraining/adaptation wrapper; use ../image-architectures/SKILL.md.
- Attention-map or embedding inspection without a loss/training objective; use ../introspection-and-customization/SKILL.md.
- General variable-resolution, N-D, or video routing unless the wrapper itself depends on the shape family, such as VAT/VAAT action conditioning; use ../variable-shapes-video/SKILL.md for pure shape/model-family questions.
Current compatibility gates
Treat these as live caveats for this generated snapshot until the bundled smoke helper proves otherwise for the installed version:
MAEandSimMIMare intended to return scalar reconstruction losses, but tiny current-package smokes with baseViTreproduce a positional-embedding shape mismatch. Do not promise they work after an upgrade without rerunning the helper.MPPis intended to return a scalar masked patch prediction loss, but the current base-ViTusage is token-shape fragile around class-token and patch embedding expectations.MP3,DistillWrapper,Dino,EsViTTrainer, Learnable MemoryAdapter,LeJEPA, VAT, SigLIP-VAT, WWT, andvit_with_decorr.ViThave tiny CPU smoke patterns in the bundled helper. Still rerun the helper in the user’s runtime, because optional dependencies and installed versions can differ.
Fast workflow
-
Identify the user’s requested wrapper and whether they need a scalar loss, logits, action predictions, or an adapter head.
-
Read references/workflows.md for the wrapper’s construction pattern and expected tensors.
-
Run a bounded check before full training:
python sub-skills/pretraining-and-adaptation/scripts/smoke_pretraining_wrappers.pyAdd
--jsonfor machine-readable output, or--case dino --case distillfor a narrow check. -
If any result is
version_fragile, explain the exact pitfall and avoid presenting that wrapper as verified. If any result isdependency_gap, name the missing optional package instead of starting a full training script. -
For long training, downloads, pretrained checkpoint loading, W&B/Accelerate, or real datasets, keep the one-step smoke separate from the heavyweight recipe and list the extra prerequisites explicitly.
Output expectations by wrapper family
- Distillation:
DistillWrapper(img, labels)returns a finite scalar loss; the distillable student can be converted back with.to_vit(). - MAE/SimMIM/MPP/MP3: intended API returns a finite scalar loss and supports
loss.backward(), but MAE/SimMIM/MPP require current-version compatibility checks before use. - DINO/EsViT/LeJEPA: constructors attach/hook a hidden layer, run augment/crop
logic, and
forward(images)returns a finite scalar self-supervised loss. DINO and EsViT also requireupdate_moving_average()after optimizer steps. - Learnable Memory ViT:
Adapter(vit=..., num_classes=...)freezes the supplied module-specific ViT and returns task logits. - VAT/SigLIP-VAT/VAAT: with
actions=..., return an L1 action-prediction loss; without actions, return predicted action chunks. Prefer explicit view/time dimensions for smoke inputs. - WWT: returns class logits, and may also return token logits, task-head outputs, or a SigReg loss depending on constructor flags.
vit_with_decorr.ViT: returns(logits, decorr_aux_loss); train with ordinary task loss plus a weighted decorrelation auxiliary term.
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).