code: def torch_recovery(obj, path, end_of_epoch):
      """Loads a torch.nn.Module state_dict from the given path instantly.
  
      This can be made the default for torch.nn.Modules with:
      >>> DEFAULT_LOAD_HOOKS[torch.nn.Module] = torch_recovery
  
      Arguments
      ---------
      obj : torch.nn.Module
          Instance for which to load the parameters.
      path : str, pathlib.Path
          Path where to load from.
      end_of_epoch : bool
          Whether the recovery comes from an end of epoch checkpoint.
  
      Returns
      -------
      None
          Given object is modified in place.
      """
      del end_of_epoch  # Unused
      device = "cpu"
      try:
          obj.load_state_dict(
              torch.load(path, map_location=device), strict=True
          )
      except TypeError:
          obj.load_state_dict(torch.load(path, map_location=device))
  
imports: import torch
  import collections
  import collections.abc
  import os
  import time
  import yaml
  import pathlib
  import inspect
  import shutil
  import logging
  import warnings
  from packaging import version
  import speechbrain.utils._workarounds
  from speechbrain.utils.distributed import main_process_only, if_main_process, ddp_barrier
label_desc: Use image node_id 1 for calling a global function with example usage: torch_recovery(obj, path, end_of_epoch) without return types