code: def load_checkpoint(model, checkpoint_path):
      if checkpoint_path and os.path.isfile(checkpoint_path):
          print("=> Loading checkpoint '{}'".format(checkpoint_path))
          checkpoint = torch.load(checkpoint_path)
          if (
              isinstance(checkpoint, dict)
              and "state_dict" in checkpoint
          ):
              new_state_dict = OrderedDict()
              for k, v in checkpoint["state_dict"].items():
                  if k.startswith("module"):
                      name = k[7:]  # remove `module.`
                  else:
                      name = k
                  new_state_dict[name] = v
              model.load_state_dict(new_state_dict)
          else:
              model.load_state_dict(checkpoint)
          print("=> Loaded checkpoint '{}'".format(checkpoint_path))
      else:
          print(
              "=> Error: No checkpoint found at '{}'".format(
                  checkpoint_path
              )
          )
          raise FileNotFoundError()
  
imports: import torch
  import os
  from collections import OrderedDict
label_desc: Use image node_id 1 for calling a global function with example usage: load_checkpoint(model, checkpoint_path) without return types