def from_vit_encoder(cls, vit_encoder: vision_transformer.Encoder):
        """Creates a IJEPA encoder from a torchvision ViT encoder."""

        # Create a new instance with dummy values as they will be overwritten
        # by the copied vit_encoder attributes
        encoder = cls(
            seq_length=1,
            num_layers=1,
            num_heads=1,
            hidden_dim=1,
            mlp_dim=1,
            dropout=0,
            attention_dropout=0,
        )
        encoder.pos_embedding = vit_encoder.pos_embedding
        encoder.dropout = vit_encoder.dropout
        encoder.layers = vit_encoder.layers
        encoder.ln = vit_encoder.ln
        return encoder
Creates a IJEPA encoder from a torchvision ViT encoder.
lightly/models/modules/ijepa.py