stable_pretraining.methods#
The methods module provides 30 ready-to-use LightningModule subclasses, one
per SSL algorithm. Each class pre-wires the backbone, loss function, optimizer,
and any required callbacks so you can start training with minimal boilerplate.
All method classes are importable from the top-level namespace:
import stable_pretraining as spt
model = spt.SimCLR(backbone=backbone, projector=projector, temperature=0.1)
Or directly from the sub-package:
from stable_pretraining.methods import SimCLR, BYOL, DINO
See stable_pretraining.forward for the stateless forward-function equivalents and
METHODS.md at the repository root for the complete method catalog.
Contrastive Methods#
Methods that learn representations by contrasting positive and negative pairs, or by bootstrapping without explicit negatives.
|
SimCLR: contrastive joint-embedding self-supervised learning. |
|
BYOL self-supervised learning with EMA target network. |
|
NNCLR: SimCLR with a nearest-neighbour queue. |
|
MoCo v2 with a fixed-size FIFO queue of momentum-encoder keys. |
|
MoCo v3: ViT-friendly momentum contrastive learning. |
|
SimSiam: simple siamese SSL with stop-gradient. |
|
PIRL: jigsaw-invariant memory-bank SSL. |
|
TiCO joint-embedding SSL. |
Feature Redundancy Reduction#
Methods that learn representations by reducing redundancy or decorrelating feature dimensions rather than using explicit contrastive pairs.
|
VICReg: variance-invariance-covariance self-supervised learning. |
|
VICRegL: VICReg with an extra local-feature term. |
|
Barlow Twins self-supervised learning. |
|
W-MSE: whitening + MSE between paired views. |
Self-Distillation and Clustering#
Methods that use momentum-updated teacher networks, self-distillation, or online clustering to learn representations without negative pairs.
|
DINO self-distillation with multi-crop and an EMA teacher. |
|
DINOv2: DINO + iBOT with Sinkhorn-Knopp on CLS and patch prototypes. |
|
DINOv3: DINOv2 with register tokens + KoLeo. |
|
iBOT: DINO on CLS + masked patch self-distillation. |
|
SwAV: prototype-based online clustering for SSL. |
|
MSN: masked siamese DINO-style SSL. |
|
data2vec for vision: predict EMA-teacher block-averaged features. |
Masked Image Modeling#
Methods that learn representations by reconstructing masked regions of the input, either in pixel space or in a latent feature space.
|
MAE: Masked Autoencoders Are Scalable Vision Learners. |
|
BEiT masked image modeling with a discrete visual tokenizer. |
|
CMAE: MAE pixel loss + EMA contrastive loss. |
|
MaskFeat: predict per-patch HOG at masked positions. |
|
SimMIM masked image modeling. |
|
Refine a pretrained MIM encoder with iBOT-style self-distillation. |
|
Autoregressive image GPT (AIM-style next-patch regression). |
|
I-JEPA: Image-based Joint-Embedding Predictive Architecture. |
|
LeJEPA: multi-view invariance + sliced Epps-Pulley SIGReg. |
|
SALT Stage 2: Static-teacher Asymmetric Latent Training. |
Other#
|
NEPA: Next-Embedding Predictive Autoregression. |