code: def torch_load(path, model):
      """Load torch model states.
  
      Args:
          path (str): Model path or snapshot file path to be loaded.
          model (torch.nn.Module): Torch model.
  
      """
      if "snapshot" in os.path.basename(path):
          model_state_dict = torch.load(
              path, map_location=lambda storage, loc: storage
          )["model"]
      else:
          model_state_dict = torch.load(
              path, map_location=lambda storage, loc: storage
          )
  
      if hasattr(model, "module"):
          model.module.load_state_dict(model_state_dict)
      else:
          model.load_state_dict(model_state_dict)
  
      del model_state_dict
  
imports: import argparse
  import copy
  import json
  import logging
  import os
  import shutil
  import tempfile
  import numpy
  import torch
label_desc: Use image node_id 14 for calling a global function with example usage: torch_load(path, model) without return types