class_docstr: VinVL base model called by MMF.
  VinVL paper, 3-way contrastive loss:
  https://arxiv.org/pdf/2101.00529.pdf
  
  Implementation based on https://github.com/microsoft/Oscar
  
  Expects VinVL features extracted by
  https://github.com/microsoft/scene_graph_benchmark
  using Visual Genome object detection labels.
  
  The label map used for training is available at
  https://github.com/microsoft/scene_graph_benchmark/blob/main/README.md
code: def build(self):
      if self.do_pretraining:
          mlm_config = self.config.heads.get("mlm")
          contrast_config = self.config.heads.get("contrast")
          self.vinvl = VinVLForPretraining(
              mlm_config=mlm_config,
              contrast_config=contrast_config,
              **self.config,
          )
      else:
          # do classification finetuning
          mlp_config = self.config.heads.get("mlp")
          loss_config = self.config.get("ce_loss")
          self.vinvl = VinVLForClassification(
              mlp_config=mlp_config,
              loss_config=loss_config,
              **self.config,
          )
  
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 VinVL obj's underlying member method code with example usage: obj.build() without return types