code: def read_in_q_k_v(state_dict, is_panoptic=False):
      prefix = ""
      if is_panoptic:
          prefix = "conditional_detr."
  
      # first: transformer encoder
      for i in range(6):
          # read in weights + bias of input projection layer (in PyTorch's MultiHeadAttention, this is a single matrix + bias)
          in_proj_weight = state_dict.pop(
              f"{prefix}transformer.encoder.layers.{i}.self_attn.in_proj_weight"
          )
          in_proj_bias = state_dict.pop(
              f"{prefix}transformer.encoder.layers.{i}.self_attn.in_proj_bias"
          )
          # next, add query, keys and values (in that order) to the state dict
          state_dict[
              f"encoder.layers.{i}.self_attn.q_proj.weight"
          ] = in_proj_weight[:256, :]
          state_dict[
              f"encoder.layers.{i}.self_attn.q_proj.bias"
          ] = in_proj_bias[:256]
          state_dict[
              f"encoder.layers.{i}.self_attn.k_proj.weight"
          ] = in_proj_weight[256:512, :]
          state_dict[
              f"encoder.layers.{i}.self_attn.k_proj.bias"
          ] = in_proj_bias[256:512]
          state_dict[
              f"encoder.layers.{i}.self_attn.v_proj.weight"
          ] = in_proj_weight[-256:, :]
          state_dict[
              f"encoder.layers.{i}.self_attn.v_proj.bias"
          ] = in_proj_bias[-256:]
  
file_path: transformers/src/transformers/models/conditional_detr/convert_conditional_detr_original_pytorch_checkpoint_to_pytorch.py
imports: import argparse
  import json
  from collections import OrderedDict
  from pathlib import Path
  import requests
  import torch
  from huggingface_hub import hf_hub_download
  from PIL import Image
  from transformers import ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalDetrForSegmentation, ConditionalDetrImageProcessor
  from transformers.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: read_in_q_k_v(state_dict, is_panoptic) without return types