docstr: This function removes all checkpoint keys that do not exist in
  the `pretrained_state_mapping`
docstr_tok: ["This","function","removes","all","checkpoint","keys","that","do","not","exist","in","the","`","pretrained_state_mapping","`"]
code: def _update_pretrained_state_mapping(
      self,
      checkpoint: Dict[str, Any],
      model: torch.nn.Module,
      config: Dict[str, Any],
  ) -> None:
      """
      This function removes all checkpoint keys that do not exist in
      the `pretrained_state_mapping`
      """
      ckpt_update_dict = get_pretrained_state_mapping_checkpoint(
          checkpoint=checkpoint, model=model, config=config
      )
      accepted_keys = set()
      for own_attr, attr in ckpt_update_dict.items():
          assert own_attr == attr, (
              "Since `_update_model_format_state_keys` was run ",
              "before, this has to be held true",
          )
          logger.info("Copying " + own_attr + " from " + attr)
          accepted_keys.add(attr)
  
      # keep only the checkpoint keys that exist in the `pretrained_state_mapping`
      tmp_checkpoint = dict(checkpoint)
      for key in tmp_checkpoint:
          if key not in accepted_keys:
              checkpoint.pop(key)
  
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 5 for calling the MMFToPLCheckpointUpdater obj's underlying member method code with example usage: obj._update_pretrained_state_mapping(checkpoint, model, config) without return types