docstr: Highly specific when the underlying tensor is a simple cat of Q,K,V instead of being
  already alternating Q,K,V within the main tensor
docstr_tok: ["Highly","specific","when","the","underlying","tensor","is","a","simple","cat","of","Q",",","K",",","V","instead","of","being","already","alternating","Q",",","K",",","V","within","the","main","tensor"]
code: def get_weights_col_packed_qkv(self, prefix: str, quantize: str):
      """
      Highly specific when the underlying tensor is a simple cat of Q,K,V instead of being
      already alternating Q,K,V within the main tensor
      """
      if quantize in ["gptq", "awq"]:
          try:
              qweight = self._get_qweight(f"{prefix}.qweight")
          except RuntimeError:
              raise RuntimeError(
                  f"Cannot load `{quantize}` weight, make sure the model is already quantized."
              )
  
          qzeros = self._get_qweight(f"{prefix}.qzeros")
          scales = self._get_qweight(f"{prefix}.scales")
          scales = scales.to(dtype=self.dtype)
          if quantize == "gptq":
              g_idx = self.get_tensor(f"{prefix}.g_idx")
          else:
              g_idx = None
  
          bits, groupsize, _ = self._get_gptq_params()
          weight = (
              qweight,
              qzeros,
              scales,
              g_idx,
              bits,
              groupsize,
              False,
          )
      else:
          slice_ = self._get_slice(f"{prefix}.weight")
          total_size = slice_.get_shape()[0]
          assert (
              total_size % 3 == 0
          ), "Prepacked qkv is not divisible by 3"
          single_size = total_size // 3
          world_size = self.process_group.size()
          rank = self.process_group.rank()
  
          assert (
              single_size % world_size == 0
          ), f"Prepacked qkv cannot be sharded across {world_size} shards"
          block_size = single_size // world_size
          start = rank * block_size
          stop = (rank + 1) * block_size
          q = slice_[start:stop]
          k = slice_[start + single_size : stop + single_size]
          v = slice_[start + 2 * single_size : stop + 2 * single_size]
          weight = torch.cat([q, k, v], dim=0)
          weight = weight.to(device=self.device)
          weight = weight.to(dtype=self.dtype)
      return weight
  
imports: import os
  from pathlib import Path
  from typing import List, Dict, Optional, Tuple
  from safetensors import safe_open, SafetensorError
  import torch
  from loguru import logger
  from huggingface_hub import hf_hub_download
  import json
  from text_generation_server.utils.log import log_once
label_desc: Use image node_id 10 for calling the Weights obj's underlying member method code with example usage: obj.get_weights_col_packed_qkv(prefix, quantize) and returns: weight