class_docstr: For integration with MMF's trainer, datasets and other features,
  models needs to inherit this class, call `super`, write a build function,
  write a forward function taking a ``SampleList`` as input and returning a
  dict as output and finally, register it using ``@registry.register_model``
  
  Args:
      config (DictConfig): ``model_config`` configuration from global config.
class_docstr_tok: ["For","integration","with","MMF","'s","trainer",",","datasets","and","other","features",",","models","needs","to","inherit","this","class",",","call","`","super","`",",","write","a","build","function",",","write","a","forward","function","taking","a","``","SampleList","``","as","input","and","returning","a","dict","as","output","and","finally",",","register","it","using","``","@","registry.register_model","``","Args",":","config","(","DictConfig",")",":","``","model_config","``","configuration","from","global","config","."]
docstr: Can be implemented if something special needs to be done to the
  key when pretrained model is being loaded. This will adapt and return
  keys according to that. Useful for backwards compatibility. See
  updated load_state_dict below. For an example, see VisualBERT model's
  code.
  
  Args:
      key (string): key to be formatted
  
  Returns:
      string: formatted key
docstr_tok: ["Can","be","implemented","if","something","special","needs","to","be","done","to","the","key","when","pretrained","model","is","being","loaded",".","This","will","adapt","and","return","keys","according","to","that",".","Useful","for","backwards","compatibility",".","See","updated","load_state_dict","below",".","For","an","example",",","see","VisualBERT","model's","code",".","Args",":","key","(","string",")",":","key","to","be","formatted","Returns",":","string",":","formatted","key"]
code: def format_state_key(cls, key):
      """Can be implemented if something special needs to be done to the
      key when pretrained model is being loaded. This will adapt and return
      keys according to that. Useful for backwards compatibility. See
      updated load_state_dict below. For an example, see VisualBERT model's
      code.
  
      Args:
          key (string): key to be formatted
  
      Returns:
          string: formatted key
      """
      return key
  
imports: import collections
  import logging
  import warnings
  from copy import deepcopy
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Union
  import pytorch_lightning
  from mmf.common.registry import registry
  from mmf.common.report import Report
  from mmf.common.sample import SampleList, to_device
  from mmf.modules.losses import LossConfig, Losses
  from mmf.utils.checkpoint import load_pretrained_model
  from mmf.utils.checkpoint_updater import MMFToPLCheckpointUpdater
  from mmf.utils.download import download_pretrained_model
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import get_current_device
  from mmf.utils.logger import log_class_usage
  from omegaconf import DictConfig, MISSING, OmegaConf
label_desc: Use image node_id 13 for calling the BaseModel obj's underlying member method code with example usage: obj.format_state_key(cls, key) and returns: key