code: def build(self):
      assert self.config.training_head_type != "pretraining"
      self.model = VisualBERTForClassification(
          self.config, self.extra_config
      )
  
      if self.config.special_visual_initialize:
          self.model.bert.embeddings.initialize_visual_from_pretrained()
  
      # Initialize from pretrained model
      if self.config.load_from_pretrained:
          # Load the raw checkpoint
          pretrained_file = self.config.pretrained_file
          with PathManager.open(pretrained_file, "rb") as f:
              ckpt = torch.load(
                  f, map_location=lambda storage, loc: storage
              )
          model_ckpt = ckpt["model"]
  
          # Remove "model" in fron of keys
          model_ckpt_new = {}
          for key in model_ckpt:
              if "bert" not in key:
                  continue
              model_ckpt_new[key.split("model.")[1]] = model_ckpt[key]
          model_ckpt = model_ckpt_new
  
          # Load the checkpoint
          incompatible_keys = self.model.load_state_dict(
              model_ckpt, strict=False
          )
  
          # Print any missing / wrong keys for debug
          if len(incompatible_keys.missing_keys) != 0:
              logger.warning(
                  f"Missing keys {incompatible_keys.missing_keys} in the"
                  + " checkpoint.\n"
                  + "If this is not your checkpoint, please open up an "
                  + "issue on MMF GitHub. \n"
                  + f"Unexpected keys if any: {incompatible_keys.unexpected_keys}"
              )
          if len(incompatible_keys.unexpected_keys) != 0:
              logger.warning(
                  "Unexpected keys in state dict: "
                  + f"{incompatible_keys.unexpected_keys} \n"
                  + "This is usually not a problem with pretrained models, but "
                  + "if this is your own model, please double check. \n"
                  + "If you think this is an issue, please open up a "
                  + "bug at MMF GitHub."
              )
  
      if getattr(self.config, "freeze_base", False):
          for p in self.model.bert.parameters():
              p.requires_grad = False
  
      # Graph input params
      self.feed_graph_to_vb = self.extra_config["feed_graph_to_vb"]
      self.graph_node_hid_dim = self.extra_config["node_hid_dim"]
      self.graph_feed_mode = self.extra_config["feed_mode"]
  
      # Not implemented for this model
      if (
          self.feed_graph_to_vb
          and self.extra_config["compress_crossmodel"]
      ):
          assert False
  
imports: import logging
  import math
  import os
  import torch
  from mmf.common.registry import registry
  from mmf.models import BaseModel
  from mmf.modules.embeddings import BertVisioLinguisticEmbeddings
  from mmf.utils.configuration import get_mmf_cache_dir
  from mmf.utils.file_io import PathManager
  from mmf.utils.modeling import get_optimizer_parameters_for_bert
  from mmf.utils.transform import transform_to_batch_sequence, transform_to_batch_sequence_dim
  from omegaconf import OmegaConf
  from torch import nn
label_desc: Use image node_id 2 for calling the VisualBERTModule obj's underlying member method code with example usage: obj.build() without return types