NNCLR#
- class stable_pretraining.methods.NNCLR(encoder_name: str | Module = 'vit_small_patch16_224', projector_dims: Sequence[int] = (2048, 256), predictor_hidden_dim: int = 4096, queue_length: int = 16384, temperature: float = 0.1, low_resolution: bool = False, pretrained: bool = False)[source]#
Bases:
ModuleNNCLR: SimCLR with a nearest-neighbour queue.
- Parameters:
encoder_name – timm model name or pre-built
nn.Module.projector_dims –
(hidden, output)for the projector (default(2048, 256)).predictor_hidden_dim – Predictor hidden dim (default 4096).
queue_length – Number of past projections to keep for the NN lookup (default 16384).
temperature – NT-Xent temperature (default 0.1).
low_resolution – Adapt first conv for low-res input.
pretrained – Load pretrained timm weights.