code: def rename_key(dct, old, new, config):
      val = dct.pop(old)
  
      if (
          "out_proj" in new
          or "v_proj" in new
          or "k_proj" in new
          or "q_proj" in new
      ) and "vision" in new:
          val = val.reshape(-1, config.vision_config.hidden_size)
      if (
          "out_proj" in new
          or "v_proj" in new
          or "k_proj" in new
          or "q_proj" in new
      ) and "text" in new:
          val = val.reshape(-1, config.text_config.hidden_size)
  
      if "patch_embedding.weight" in new:
          val = val.transpose(3, 2, 0, 1)
      elif (
          new.endswith("weight")
          and "position_embedding" not in new
          and "token_embedding" not in new
      ):
          val = val.T
  
      if "position_embedding" in new and "vision" in new:
          val = val.reshape(-1, config.vision_config.hidden_size)
      if "position_embedding" in new and "text" in new:
          val = val.reshape(-1, config.text_config.hidden_size)
  
      if new.endswith("bias"):
          val = val.reshape(-1)
  
      dct[new] = torch.from_numpy(val)
  
file_path: transformers/src/transformers/models/siglip/convert_siglip_to_hf.py
imports: import argparse
  import collections
  from pathlib import Path
  import numpy
  import requests
  import torch
  from huggingface_hub import hf_hub_download
  from numpy import load
  from PIL import Image
  from transformers import SiglipConfig, SiglipImageProcessor, SiglipModel, SiglipProcessor, SiglipTokenizer
  from transformers.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: rename_key(dct, old, new, config) without return types