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 mlm_forward(
      self,
      input_ids_masked: Tensor,
      lm_label_ids: Tensor,
      token_type_ids: Tensor,
      attention_mask: Tensor,
      img_feats: Tensor,
      position_ids: Optional[Tensor] = None,
  ) -> Dict[str, Tensor]:
      hidden_layers = self.bert(
          input_ids_masked,
          img_feats=img_feats,
          position_ids=position_ids,
          token_type_ids=token_type_ids,
          attention_mask=attention_mask,
      ).last_hidden_state
  
      mlm_labels = {}
      mlm_labels["text"] = lm_label_ids
      mlm_labels["image"] = torch.full(
          img_feats.shape[:2],
          fill_value=-1,
          dtype=torch.long,
          device=lm_label_ids.device,
      )
      mlm_labels["combined_labels"] = torch.cat(
          [mlm_labels["text"], mlm_labels["image"]], dim=-1
      )
  
      processed_sample_list = SampleList({"mlm_labels": mlm_labels})
      return self.mlm_head(
          hidden_layers, processed_sample_list=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 2 for calling the VinVLForPretraining obj's underlying member method code with example usage: obj.mlm_forward(input_ids_masked, lm_label_ids, token_type_ids, attention_mask, img_feats, position_ids) and returns: self