code: def __init__(self, cfg: Data2VecImageClassificationConfig):
      super().__init__()
      self.cfg = cfg
  
      if cfg.pretrained_model_args is None:
          state = checkpoint_utils.load_checkpoint_to_cpu(
              cfg.model_path, {}
          )
          pretrained_args = state.get("cfg", None)
          pretrained_args.criterion = None
          pretrained_args.lr_scheduler = None
          cfg.pretrained_model_args = pretrained_args
  
          logger.info(pretrained_args)
      else:
          state = None
          pretrained_args = cfg.pretrained_model_args
  
      pretrained_args.task.data = cfg.data
      task = tasks.setup_task(pretrained_args.task)
      model = task.build_model(
          pretrained_args.model, from_checkpoint=True
      )
  
      model.remove_pretraining_modules()
  
      self.model = model
  
      if state is not None and not cfg.no_pretrained_weights:
          self.load_model_weights(state, model, cfg)
  
      self.fc_norm = nn.LayerNorm(pretrained_args.model.embed_dim)
      self.head = nn.Linear(
          pretrained_args.model.embed_dim, cfg.num_classes
      )
  
      self.head.weight.data.mul_(1e-3)
      self.head.bias.data.mul_(1e-3)
  
      self.mixup_fn = None
  
      if cfg.mixup > 0 or cfg.cutmix > 0:
          from timm.data import Mixup
  
          self.mixup_fn = Mixup(
              mixup_alpha=cfg.mixup,
              cutmix_alpha=cfg.cutmix,
              cutmix_minmax=None,
              prob=1.0,
              switch_prob=0.5,
              mode="batch",
              label_smoothing=cfg.label_smoothing,
              num_classes=cfg.num_classes,
          )
  
file_path: fairseq/examples/data2vec/models/data2vec_image_classification.py
imports: import logging
  from dataclasses import dataclass
  from typing import Any
  from omegaconf import II, MISSING
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import checkpoint_utils, tasks
  from fairseq.dataclass import FairseqDataclass
  from fairseq.models import BaseFairseqModel, register_model
label_desc: Use image node_id 1 to create a new Data2VecImageClassificationModel object from inherited base classes: BaseFairseqModel with example: obj = Data2VecImageClassificationModel(cfg)