class
IJEPAForImageClassification
extends
ImageClassificationModelClassificationHeadMixinIJEPAForImageClassification(config: IJEPAConfig)A linear probe on I-JEPA's representation.
Parameters
configIJEPAConfigFrozen configuration;
num_classes sizes the head.Attributes
ijepaIJEPAModelThe pretrained networks.
headnn.LinearThe probe, over the average-pooled target encoder.
Notes
Reference: Assran et al., arXiv:2301.08243, Appendix A.2 — the paper evaluates by linear probing the frozen target encoder, which is what this is. The target encoder cannot be trained through this class: its parameters are frozen where they are built, so an optimiser handed everything still only moves the head.
It carries the whole pretraining model — both encoders and the predictor — because that is what a checkpoint holds and what continuing to pretrain would need. Inference uses one of the three, so an exported package is about three times the size it has to be.
Examples
>>> import lucid
>>> from lucid.models.vision.ijepa import (
... IJEPAConfig, IJEPAForImageClassification)
>>> config = IJEPAConfig(
... image_size=32, patch_size=8, dim=16, depth=1, num_heads=2,
... predictor_dim=8, predictor_depth=1, num_classes=10, min_keep=1)
>>> model = IJEPAForImageClassification(config).eval()
>>> model(lucid.rand(2, 3, 32, 32)).logits.shape
(2, 10)Used by 2
Constructors
1Instance methods
1forward(x: Tensor, labels: Tensor | None = None)Classify images from the frozen representation.
Parameters
Returns
ImageClassificationOutputLogits (B, num_classes), and the loss when labels came.