[Quantization] Support native Quark W4A16 INT4/UINT4 exports in vLLM (#48606)
Signed-off-by: HongWei Meng <HongWei.Meng@amd.com>
This commit is contained in:
@@ -93,7 +93,7 @@ def _replace_or_register_parameter(
|
||||
def _convert_awq_to_standard_format(
|
||||
layer: torch.nn.Module,
|
||||
w_q_name: str,
|
||||
w_zp_name: str,
|
||||
w_zp_name: str | None,
|
||||
size_bits: int,
|
||||
) -> None:
|
||||
"""Convert AWQ weight and zero-point tensors to standard GPTQ-like format.
|
||||
@@ -101,6 +101,7 @@ def _convert_awq_to_standard_format(
|
||||
AWQ packs qweight along the output dim with a non-standard bit order.
|
||||
This converts to standard bit order and repacks qweight along the input
|
||||
dim, matching the format expected by the MPLinearKernel framework.
|
||||
If w_zp_name is None (symmetric quantization), only the weight is converted.
|
||||
"""
|
||||
pack_factor = 32 // size_bits
|
||||
mask = (1 << size_bits) - 1
|
||||
@@ -139,6 +140,9 @@ def _convert_awq_to_standard_format(
|
||||
)
|
||||
setattr(layer, w_q_name, new_param)
|
||||
|
||||
if w_zp_name is None:
|
||||
return
|
||||
|
||||
# --- Convert qzeros: fix AWQ bit ordering and repack
|
||||
# AWQ qzeros: (G, N // pack) packed along dim 1, AWQ bit order
|
||||
# Target: (N // pack, G) packed along dim 0, standard bit order
|
||||
|
||||
Reference in New Issue
Block a user