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 forward(
      self,
      input_ids_masked: Tensor,
      input_ids_corrupt: Tensor,
      lm_label_ids: Tensor,
      contrastive_labels: Tensor,
      token_type_ids: Tensor,
      attention_mask: Tensor,
      token_type_ids_corrupt: Tensor,
      attention_mask_corrupt: Tensor,
      img_feats: Tensor,
      position_ids: Optional[Tensor] = None,
  ) -> Dict[str, Tensor]:
      mlm_result = self.mlm_forward(
          input_ids_masked,
          lm_label_ids,
          token_type_ids,
          attention_mask,
          img_feats,
          position_ids,
      )
  
      contrastive_loss_result = self.contrastive_forward(
          input_ids_corrupt,
          token_type_ids_corrupt,
          attention_mask_corrupt,
          img_feats,
          contrastive_labels,
          position_ids,
      )
      losses = {**mlm_result, **contrastive_loss_result}
      return {"losses": 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 4 for calling the VinVLForPretraining obj's underlying member method code with example usage: obj.forward(input_ids_masked, input_ids_corrupt, lm_label_ids, contrastive_labels, token_type_ids, attention_mask, token_type_ids_corrupt, attention_mask_corrupt, img_feats, position_ids) and returns: dict