code: def read_in_q_k_v(state_dict, encoder_config):
      for i in range(encoder_config.num_hidden_layers):
          # queries, keys and values (only weights, no biases)
          in_proj_weight = state_dict.pop(
              f"encoder.deit.blocks.{i}.attn.qkv.weight"
          )
  
          state_dict[
              f"encoder.encoder.layer.{i}.attention.attention.query.weight"
          ] = in_proj_weight[: encoder_config.hidden_size, :]
          state_dict[
              f"encoder.encoder.layer.{i}.attention.attention.key.weight"
          ] = in_proj_weight[
              encoder_config.hidden_size : encoder_config.hidden_size
              * 2,
              :,
          ]
          state_dict[
              f"encoder.encoder.layer.{i}.attention.attention.value.weight"
          ] = in_proj_weight[-encoder_config.hidden_size :, :]
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/trocr/convert_trocr_unilm_to_pytorch.py
imports: import argparse
  from pathlib import Path
  import torch
  from PIL import Image
  import requests
  from transformers import RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTFeatureExtractor, ViTModel
  from transformers.utils import logging
label_desc: Use image node_id 2 for calling a global function with example usage: read_in_q_k_v(state_dict, encoder_config) without return types