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","."]
code: def __call__(self, sample_list, *args, **kwargs):
      if not self._is_pl_enabled:
          # Move to proper device i.e. same as the model before passing
          sample_list = to_device(sample_list, get_current_device())
  
      model_output = super().__call__(sample_list, *args, **kwargs)
  
      # Don't do anything fancy to output if it is pretrained
      if self.is_pretrained:
          return model_output
  
      # Make sure that the output from the model is a Mapping
      assert isinstance(
          model_output, collections.abc.Mapping
      ), "A dict must be returned from the forward of the model."
  
      if "losses" in model_output:
          if not self._logged_warning["losses_present"]:
              warnings.warn(
                  "'losses' already present in model output. "
                  "No calculation will be done in base model."
              )
              self._logged_warning["losses_present"] = True
  
          assert isinstance(
              model_output["losses"], collections.abc.Mapping
          ), "'losses' must be a dict."
      elif hasattr(self, "losses"):
          model_output["losses"] = self.losses(
              sample_list, model_output
          )
      else:
          model_output["losses"] = {}
  
      return model_output
  
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 24 for calling the BaseModel obj's underlying member method code with example usage: obj.__call__(sample_list) and returns: model_output, model_output