class_docstr: VINVL wrapper for pretraining
  MLM loss is described in https://arxiv.org/pdf/2004.06165.pdf
  Contrastive loss is an itm loss to guess,
      0 for a match,
      1 for a corrupt caption,
      2 for corrupt image labels
  VinVL trains with object detection labels concatenated with the input text.
code: def contrastive_forward(
      self,
      input_ids: Tensor,
      token_type_ids: Tensor,
      attention_mask: Tensor,
      img_feats: Tensor,
      contrastive_labels: Tensor,
      position_ids: Optional[Tensor] = None,
  ) -> Dict[str, Tensor]:
      last_hidden_state = self.bert(
          input_ids,
          img_feats=img_feats,
          position_ids=position_ids,
          token_type_ids=token_type_ids,
          attention_mask=attention_mask,
      ).last_hidden_state
      processed_sample_list = SampleList(
          {"contrastive_labels": contrastive_labels}
      )
      # contrastive 3-way loss has 3 classes,
      # 0 for a match, 1, 2 for a corrupt caption/image
      # labels respectively
      return self.contrast_head(
          last_hidden_state, processed_sample_list
      )["losses"]
  
imports: import logging
  from collections import namedtuple
  from dataclasses import asdict, dataclass
  from typing import Any, Dict, Optional, Tuple
  import torch
  from mmf.common.registry import registry
  from mmf.common.sample import SampleList
  from mmf.models.base_model import BaseModel
  from mmf.models.transformers.heads.contrastive import ThreeWayContrastive
  from mmf.models.transformers.heads.mlm import MLM
  from mmf.models.transformers.heads.mlp import MLP
  from mmf.utils.general import retry_n
  from omegaconf import MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 3 for calling the VinVLForPretraining obj's underlying member method code with example usage: obj.contrastive_forward(input_ids, token_type_ids, attention_mask, img_feats, contrastive_labels, position_ids) and returns: self