ssl-building-blocks
Assemble Lightly low-level SSL data, transform, loss, head, and memory-bank components.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- ssl-building-blocks
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Assemble Lightly low-level SSL data, transform, loss, head, and memory-bank components.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/api-reference.md9.6 KB
- 参考文档references/method-map.md3.7 KB
- 参考文档references/troubleshooting.md3.4 KB
03 SKILL.md 正文
SSL Building Blocks
Use this sub-skill when a task asks how to compose LightlySSL's low-level pieces without committing to a full CLI or training recipe. It is the right route for API signatures, transform/loss/head selection, tensor shapes, optional component availability, and no-download component smoke tests.
Use this sub-skill for
lightly.data.LightlyDataset,LightlyDataset.from_torch_dataset, image/video dataset behavior, and collate functions.- Method transforms such as SimCLR, BYOL, SimSiam, MoCo, DINO, SwaV, VICReg, MAE, MSN, iBOT, CAPI, LeJEPA, Pixio, and related families.
- SSL losses, projection/prediction heads, prototypes, and memory banks.
- Deprecated high-level model wrappers only as compatibility references; prefer low-level modules for new workflows.
- Optional
lightly[timm]andlightly[video]branches when a task explicitly needs TIMM/ViT modules or direct video-file datasets. - Tensor-only smoke checks that should not download datasets, run notebooks, or start long training.
Route elsewhere for
- Full training loops, PyTorch Lightning recipes, local-folder training plans, or distributed training decisions: use
training-workflows. - CLI/Hydra/data-folder/crop/embedding commands: use
cli-data-embedding. - KNN/linear evaluation, benchmark utilities, repository tests, docs, notebooks, or maintainer checks: use
evaluation-maintenance.
First actions
- Identify the method family and output arity: two-view, multi-crop/multi-view, masked-image, dense/local, or clustering/prototype.
- Read Method map to choose compatible transforms, collates, heads, losses, and optional dependencies.
- Confirm signatures and tensor contracts in API reference, especially
input_dim, output feature width,gather_distributed, memory-bank shape, and optional TIMM/video availability. - Run Smoke script on CPU before moving to real data or a full training loop.
- If the smoke fails, read Troubleshooting and fix shape/arity/optional-extra issues before routing to
training-workflows.
Common decisions
- Prefer
SimCLRTransform+SimCLRProjectionHead+NTXentLossfor simple contrastive smoke checks. - Use DINO/SwaV/MSN/iBOT transforms or collates only when the downstream code expects a list of global/local crops.
- Set projection-head
input_dimto the actual backbone feature width; do not force the loss to compensate for mismatched dimensions. - Set
gather_distributed=Trueonly inside an initialized distributed process group. - Install
lightly[timm]orlightly[video]only for workflows that need those optional branches; basepip install lightlyis enough for most CPU component checks.
Install reminder
- Base package:
pip install lightly - Optional TIMM/ViT modules:
pip install "lightly[timm]" - Optional direct video support:
pip install "lightly[video]"
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.