code: def read_in_q_k_v(state_dict, config, base_model=False):
      for i in range(config.num_hidden_layers):
          if base_model:
              prefix = ""
          else:
              prefix = "vit."
          # read in weights + bias of input projection layer (in timm, this is a single matrix + bias)
          in_proj_weight = state_dict.pop(
              f"module.blocks.{i}.attn.qkv.weight"
          )
          in_proj_bias = state_dict.pop(
              f"module.blocks.{i}.attn.qkv.bias"
          )
          # next, add query, keys and values (in that order) to the state dict
          state_dict[
              f"{prefix}encoder.layer.{i}.attention.attention.query.weight"
          ] = in_proj_weight[: config.hidden_size, :]
          state_dict[
              f"{prefix}encoder.layer.{i}.attention.attention.query.bias"
          ] = in_proj_bias[: config.hidden_size]
          state_dict[
              f"{prefix}encoder.layer.{i}.attention.attention.key.weight"
          ] = in_proj_weight[
              config.hidden_size : config.hidden_size * 2, :
          ]
          state_dict[
              f"{prefix}encoder.layer.{i}.attention.attention.key.bias"
          ] = in_proj_bias[config.hidden_size : config.hidden_size * 2]
          state_dict[
              f"{prefix}encoder.layer.{i}.attention.attention.value.weight"
          ] = in_proj_weight[-config.hidden_size :, :]
          state_dict[
              f"{prefix}encoder.layer.{i}.attention.attention.value.bias"
          ] = in_proj_bias[-config.hidden_size :]
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/vit_msn/convert_msn_to_pytorch.py
imports: import argparse
  import json
  import torch
  from PIL import Image
  import requests
  from huggingface_hub import hf_hub_download
  from transformers import ViTFeatureExtractor, ViTMSNConfig, ViTMSNModel
  from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
label_desc: Use image node_id 2 for calling a global function with example usage: read_in_q_k_v(state_dict, config, base_model) without return types