code: def restore_bloom_weight(ckpt: dict, n_head: int, n_embed: int):
      # see https://github.com/ggerganov/llama.cpp/
      # blob/master/convert-hf-to-gguf.py#L374
      import numpy as np
  
      for name, weight in ckpt.items():
          if name.endswith("attn_qkv.weight"):
              part1, part2, part3 = np.split(
                  weight.reshape(-1, n_embed), 3, axis=0
              )
              part1 = part1.reshape(
                  (n_head, 1, n_embed // n_head, n_embed)
              )
              part2 = part2.reshape(
                  (n_head, 1, n_embed // n_head, n_embed)
              )
              part3 = part3.reshape(
                  (n_head, 1, n_embed // n_head, n_embed)
              )
              data = torch.cat([part1, part2, part3], dim=1)
              ckpt[name] = data.reshape(-1, n_embed)
          elif name.endswith("attn_qkv.bias"):
              part1, part2, part3 = np.split(weight, 3, axis=0)
              part1 = part1.reshape((n_head, 1, n_embed // n_head))
              part2 = part2.reshape((n_head, 1, n_embed // n_head))
              part3 = part3.reshape((n_head, 1, n_embed // n_head))
              data = torch.cat([part1, part2, part3], dim=1)
              ckpt[name] = data.reshape(
                  3 * n_embed,
              )
      return ckpt
  
imports: import torch
  import os
  from accelerate import init_empty_weights
  from accelerate.utils import set_module_tensor_to_device
  from transformers import BloomConfig, BloomForCausalLM, BloomTokenizerFast
  from ..gguf import GGUFFileLoader
label_desc: Use image node_id 2 for calling a global function with example usage: restore_bloom_weight(ckpt, n_head, n_embed) and returns: ckpt