code: def load_checkpoint(checkpoint_path):
      """Checkpoint path should end in model.pt"""
      sd = torch.load(checkpoint_path, map_location="cpu")
      if "model" in sd.keys():
          sd = torch.load(checkpoint_path, map_location="cpu")["model"]
  
      # pop unnecessary weights
      keys_to_delete = [
          "decoder.version",
          "decoder.output_projection.weight",
      ]
      for key in keys_to_delete:
          if key in sd:
              sd.pop(key)
  
      keys_to_rename = {
          "decoder.project_in_dim.weight": "decoder.project_in.weight",
          "decoder.project_out_dim.weight": "decoder.project_out.weight",
          "decoder.layer_norm.weight": "decoder.final_layer_norm.weight",
          "decoder.layer_norm.bias": "decoder.final_layer_norm.bias",
      }
      for old_key, new_key in keys_to_rename.items():
          if old_key in sd:
              sd[new_key] = sd.pop(old_key)
  
      return sd
  
imports: import argparse
  from pathlib import Path
  import torch
  from transformers import OPTConfig, OPTModel
  from transformers.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: load_checkpoint(checkpoint_path) and returns: sd