code: def make_delta(
      base_model_path, target_model_path, delta_path, hub_repo_id
  ):
      print("Loading base model")
      base = AutoModelForCausalLM.from_pretrained(
          base_model_path,
          torch_dtype=torch.float16,
          low_cpu_mem_usage=True,
      )
  
      print("Loading target model")
      auto_upgrade(target_model_path)
      target = AutoModelForCausalLM.from_pretrained(
          target_model_path,
          torch_dtype=torch.float16,
          low_cpu_mem_usage=True,
      )
  
      print("Calculating delta")
      for name, param in tqdm(
          target.state_dict().items(), desc="Calculating delta"
      ):
          if name not in base.state_dict():
              assert (
                  name in exclude_name_lists
              ), f"{name} not in base model"
              continue
          if param.data.shape == base.state_dict()[name].shape:
              param.data -= base.state_dict()[name]
          else:
              assert name in [
                  "model.embed_tokens.weight",
                  "lm_head.weight",
              ], f"{name} dimension mismatch: {param.data.shape} vs {base.state_dict()[name].shape}"
              bparam = base.state_dict()[name]
              param.data[: bparam.shape[0], : bparam.shape[1]] -= bparam
  
      print("Saving delta")
      if hub_repo_id:
          kwargs = {"push_to_hub": True, "repo_id": hub_repo_id}
      else:
          kwargs = {}
      target.save_pretrained(delta_path, **kwargs)
      target_tokenizer = AutoTokenizer.from_pretrained(
          target_model_path
      )
      target_tokenizer.save_pretrained(delta_path, **kwargs)
  
imports: import argparse
  import torch
  from tqdm import tqdm
  from transformers import AutoTokenizer, AutoModelForCausalLM
  from ferret.model.utils import auto_upgrade
label_desc: Use image node_id 1 for calling a global function with example usage: make_delta(base_model_path, target_model_path, delta_path, hub_repo_id) without return types