code: def __init__(self):
      super().__init__()
      resnet = torchvision.models.resnet18()
      backbone = nn.Sequential(*list(resnet.children())[:-1])
      input_dim = 512
      # instead of a resnet you can also use a vision transformer backbone as in the
      # original paper (you might have to reduce the batch size in this case):
      # backbone = torch.hub.load('facebookresearch/dino:main', 'dino_vits16', pretrained=False)
      # input_dim = backbone.embed_dim
  
      self.student_backbone = backbone
      self.student_head = DINOProjectionHead(
          input_dim, 512, 64, 2048, freeze_last_layer=1
      )
      self.teacher_backbone = copy.deepcopy(backbone)
      self.teacher_head = DINOProjectionHead(input_dim, 512, 64, 2048)
      deactivate_requires_grad(self.teacher_backbone)
      deactivate_requires_grad(self.teacher_head)
  
      self.criterion = DINOLoss(
          output_dim=2048, warmup_teacher_temp_epochs=5
      )
  
file_path: lightly/examples/pytorch_lightning/dino.py
imports: import copy
  import pytorch_lightning
  import torch
  import torchvision
  from torch import nn
  from lightly.loss import DINOLoss
  from lightly.models.modules import DINOProjectionHead
  from lightly.models.utils import deactivate_requires_grad, update_momentum
  from lightly.transforms.dino_transform import DINOTransform
  from lightly.utils.scheduler import cosine_schedule
label_desc: Use image node_id 1 to create a new DINO object from inherited base classes: pl with example: obj = DINO()