code: def merge_input_projection(state):
      """
      New checkpoints of fairseq multihead attention split in_projections into
      k,v,q projections. This function merge them back to to make it compatible.
      """
      items_to_add = {}
      keys_to_remove = []
      bias_suffix = ["q_proj.bias", "k_proj.bias", "v_proj.bias"]
      weight_suffix = [
          "q_proj.weight",
          "k_proj.weight",
          "v_proj.weight",
      ]
  
      def override_state(k, suffix, new_suffix, idx):
          new_key = k[: -len(suffix)] + new_suffix
          dim = state[k].shape[0]
          if new_key not in items_to_add:
              items_to_add[new_key] = (
                  torch.zeros_like(state[k]).repeat(3, 1)
                  if len(state[k].shape) > 1
                  else torch.zeros_like(state[k]).repeat(3)
              )
          items_to_add[new_key][idx * dim : (idx + 1) * dim] = state[k]
          keys_to_remove.append(k)
  
      for k in state.keys():
          # weights
          for idx, suffix in enumerate(weight_suffix):
              if k.endswith(suffix):
                  override_state(k, suffix, "in_proj_weight", idx)
          # bias
          for idx, suffix in enumerate(bias_suffix):
              if k.endswith(suffix):
                  override_state(k, suffix, "in_proj_bias", idx)
  
      for k in keys_to_remove:
          del state[k]
  
      for key, value in items_to_add.items():
          state[key] = value
  
      return state
  
imports: import re
  from typing import List, Optional
  import torch
  from pytext.utils.usage import log_class_usage
  from pytorch.text.fb.nn.modules.transformer import Transformer
  from torch import nn
label_desc: Use image node_id 5 for calling a global function with example usage: merge_input_projection(state) and returns: state