code: def process_checkpoint(
      in_file, out_file, save_keys=["meta", "state_dict"]
  ):
      checkpoint = torch.load(in_file, map_location="cpu")
  
      # only keep `meta` and `state_dict` for smaller file size
      ckpt_keys = list(checkpoint.keys())
      for k in ckpt_keys:
          if k not in save_keys:
              print_log(
                  f"Key `{k}` will be removed because it is not in "
                  f"save_keys. If you want to keep it, "
                  f"please set --save-keys.",
                  logger="current",
              )
              checkpoint.pop(k, None)
  
      # if it is necessary to remove some sensitive data in checkpoint['meta'],
      # add the code here.
      if torch.__version__ >= "1.6":
          torch.save(
              checkpoint, out_file, _use_new_zipfile_serialization=False
          )
      else:
          torch.save(checkpoint, out_file)
      sha = subprocess.check_output(["sha256sum", out_file]).decode()
      final_file = out_file.rstrip(".pth") + f"-{sha[:8]}.pth"
      subprocess.Popen(["mv", out_file, final_file])
      print_log(
          f"The published model is saved at {final_file}.",
          logger="current",
      )
  
imports: import argparse
  import subprocess
  import torch
  from mmengine.logging import print_log
label_desc: Use image node_id 2 for calling a global function with example usage: process_checkpoint(in_file, out_file, save_keys) without return types