code: def get_pretrained_state_mapping_checkpoint(
      checkpoint: Dict[str, Any],
      model: torch.nn.Module,
      config: Dict[str, Any],
  ) -> Dict[str, Any]:
      """
      This function gets the checkpoint keys that exists in pretrained state mapping
      that also exist in model's state, and returns a dictionary with the value from the
      `checkpoint` dict.
      """
      mapping = config.checkpoint.pretrained_state_mapping
      own_state = model.state_dict()
      tmp_checkpoint = dict(checkpoint)
  
      ckpt_update_dict = dict()
      for key, value in mapping.items():
          key += "."
          value += "."
          for attr in tmp_checkpoint:
              formatted_attr = _format_state_key(model, attr)
              for own_attr in own_state:
                  if (
                      key in own_attr
                      and value in formatted_attr
                      and own_attr.replace(key, "")
                      == formatted_attr.replace(value, "")
                  ):
                      if _should_skip_if_mismatch(
                          (own_attr, own_state[own_attr].shape),
                          (attr, checkpoint[attr].shape),
                          config,
                      ):
                          continue
                      ckpt_update_dict[own_attr] = attr
      return ckpt_update_dict
  
file_path: mmf/mmf/utils/checkpoint_updater.py
imports: import logging
  from typing import Any, Dict, Tuple
  import torch
  from mmf.common.registry import registry
label_desc: Use image node_id 6 for calling a global function with example usage: get_pretrained_state_mapping_checkpoint(checkpoint, model, config) and returns: ckpt_update_dict