code: def load_weights(model: nn.Module, path_to_weights: str) -> nn.Module:
      ckpt = torch.load(
          path_to_weights, map_location=lambda storage, loc: storage
      )
  
      # this seems to be necessary
      for key in ckpt["state_dict"].copy():
          if (
              ("loss" in key)
              or ("crps" in key)
              or ("quantile_width" in key)
          ):
              ckpt["state_dict"].pop(key)
  
      new_state_dict = OrderedDict()
      for k, v in ckpt["state_dict"].items():
          name = k.replace("model.", "")
          new_state_dict[name] = v
  
      model.load_state_dict(new_state_dict)
      return model
  
label_desc: Use image node_id 1 for calling a global function with example usage: load_weights(model, path_to_weights) and returns: model