code: def load_checkpoint(
      pathname: PathLike,
      *,
      map_location: MapLocation = None,
      restrict: bool = False,
      converter: Optional[CheckpointConverter] = None,
  ) -> Dict[str, Any]:
      """Load the checkpoint stored in ``pathname``.
  
      :param pathname:
          The pathname of the checkpoint.
      :param map_location:
          Same as the ``map_location`` parameter of :meth:`torch.load`.
      :param restrict:
          If ``True``, restricts the Python unpickler to load only tensors,
          primitive types, and dictionaries.
      :param converter:
          The converter to which the loaded checkpoint will be passed for further
          processing.
  
      :returns:
          The loaded checkpoint.
      """
      with warnings.catch_warnings():
          # Suppress the noisy deprecated `TypedStorage` warning.
          warnings.simplefilter("ignore")
  
          kwargs = {}
  
          if _is_pt21_or_greater():
              kwargs["mmap"] = True
  
          checkpoint: Dict[str, Any] = torch.load(
              str(pathname),
              map_location,
              weights_only=restrict,
              **kwargs,
          )
  
      if converter is not None:
          checkpoint = converter(checkpoint)
  
      return checkpoint
  
file_path: fairseq2/src/fairseq2/models/utils/checkpoint.py
imports: import re
  import warnings
  from typing import Any, Callable, Dict, Mapping, Optional, Protocol, Union
  import torch
  from torch import Tensor
  from typing_extensions import TypeAlias
  from fairseq2.data.typing import PathLike
  from fairseq2.typing import Device
  from fairseq2.utils.version import _is_pt21_or_greater
label_desc: Use image node_id 1 for calling a global function with example usage: load_checkpoint(pathname) and returns: checkpoint