code: def create_rename_keys(
      config,
      has_lm_head=False,
      is_semantic=False,
      hf_prefix="data2vec.",
  ):
      prefix = "backbone." if is_semantic else ""
  
      rename_keys = []
      for i in range(config.num_hidden_layers):
          # encoder layers: output projection, 2 feedforward neural networks and 2 layernorms
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.norm1.weight",
                  f"{hf_prefix}encoder.layer.{i}.layernorm_before.weight",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.norm1.bias",
                  f"{hf_prefix}encoder.layer.{i}.layernorm_before.bias",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.attn.proj.weight",
                  f"{hf_prefix}encoder.layer.{i}.attention.output.dense.weight",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.attn.proj.bias",
                  f"{hf_prefix}encoder.layer.{i}.attention.output.dense.bias",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.norm2.weight",
                  f"{hf_prefix}encoder.layer.{i}.layernorm_after.weight",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.norm2.bias",
                  f"{hf_prefix}encoder.layer.{i}.layernorm_after.bias",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.mlp.fc1.weight",
                  f"{hf_prefix}encoder.layer.{i}.intermediate.dense.weight",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.mlp.fc1.bias",
                  f"{hf_prefix}encoder.layer.{i}.intermediate.dense.bias",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.mlp.fc2.weight",
                  f"{hf_prefix}encoder.layer.{i}.output.dense.weight",
              )
          )
          rename_keys.append(
              (
                  f"{prefix}blocks.{i}.mlp.fc2.bias",
                  f"{hf_prefix}encoder.layer.{i}.output.dense.bias",
              )
          )
  
      # projection layer + position embeddings
      rename_keys.extend(
          [
              (
                  f"{prefix}cls_token",
                  f"{hf_prefix}embeddings.cls_token",
              ),
              (
                  f"{prefix}patch_embed.proj.weight",
                  f"{hf_prefix}embeddings.patch_embeddings.projection.weight",
              ),
              (
                  f"{prefix}patch_embed.proj.bias",
                  f"{hf_prefix}embeddings.patch_embeddings.projection.bias",
              ),
          ]
      )
  
      if has_lm_head:
          # mask token + shared relative position bias + layernorm
          rename_keys.extend(
              [
                  ("mask_token", f"{hf_prefix}embeddings.mask_token"),
                  (
                      "rel_pos_bias.relative_position_bias_table",
                      f"{hf_prefix}encoder.relative_position_bias.relative_position_bias_table",
                  ),
                  (
                      "rel_pos_bias.relative_position_index",
                      f"{hf_prefix}encoder.relative_position_bias.relative_position_index",
                  ),
                  ("norm.weight", "layernorm.weight"),
                  ("norm.bias", "layernorm.bias"),
              ]
          )
      elif is_semantic:
          # semantic segmentation classification heads
          rename_keys.extend(
              [
                  (
                      "decode_head.conv_seg.weight",
                      "decode_head.classifier.weight",
                  ),
                  (
                      "decode_head.conv_seg.bias",
                      "decode_head.classifier.bias",
                  ),
                  (
                      "auxiliary_head.conv_seg.weight",
                      "auxiliary_head.classifier.weight",
                  ),
                  (
                      "auxiliary_head.conv_seg.bias",
                      "auxiliary_head.classifier.bias",
                  ),
              ]
          )
      else:
          # layernorm + classification head
          rename_keys.extend(
              [
                  (
                      "fc_norm.weight",
                      f"{hf_prefix}pooler.layernorm.weight",
                  ),
                  ("fc_norm.bias", f"{hf_prefix}pooler.layernorm.bias"),
                  ("head.weight", "classifier.weight"),
                  ("head.bias", "classifier.bias"),
              ]
          )
  
      return rename_keys
  
file_path: transformers/src/transformers/models/data2vec/convert_data2vec_vision_original_pytorch_checkpoint_to_pytorch.py
imports: import argparse
  import json
  import torch
  from huggingface_hub import hf_hub_download
  from PIL import Image
  from timm.models import create_model
  from transformers import BeitImageProcessor, Data2VecVisionConfig, Data2VecVisionForImageClassification, Data2VecVisionModel
label_desc: Use image node_id 1 for calling a global function with example usage: create_rename_keys(config, has_lm_head, is_semantic, hf_prefix) and returns: rename_keys