class_docstr: Base class to help with generalized loading of pretrained weights.
  
  Subclasses should override `_from_config()` if you want to instantiate them with
  `from_pretrained_module()`.
class_docstr_tok: ["Base","class","to","help","with","generalized","loading","of","pretrained","weights",".","Subclasses","should","override","`","_from_config","(",")","`","if","you","want","to","instantiate","them","with","`","from_pretrained_module","(",")","`","."]
docstr: Returns the mapping to be used, based on the optional `mapping` overrides
  and the default module-level mapping.
docstr_tok: ["Returns","the","mapping","to","be","used",",","based","on","the","optional","`","mapping","`","overrides","and","the","default","module-level","mapping","."]
code: def _get_mapping(
      cls,
      mapping: Optional[Dict[str, str]] = None,
  ):
      """
      Returns the mapping to be used, based on the optional `mapping` overrides
      and the default module-level mapping.
      """
      combined_mapping = {}
      combined_mapping.update(cls._pretrained_mapping)
      if mapping is not None:
          combined_mapping.update(mapping)
      return combined_mapping
  
imports: import logging
  import os
  from os import PathLike
  from typing import TYPE_CHECKING, Optional, Dict, Union, List, Any, TypeVar, Type
  import re
  import warnings
  import torch
  import torch.distributed
  from allennlp.common.util import is_distributed, is_global_primary
  from allennlp.nn.parallel import ShardedModuleMixin
  from allennlp.nn.module import Module
  from allennlp.nn.util import StateDictType, read_state_dict, _check_incompatible_keys
label_desc: Use image node_id 1 for calling the TransformerModule obj's underlying member method code with example usage: obj._get_mapping(cls, mapping) and returns: combined_mapping