Repository navigation
Description
Summary
AWQConfig(bits=4, group_size=128, lm_head=True) quantizes and saves without error. At save time GPT-QModel warns:
WARN Model: `lm_head=True` stores the output head as quantized `lm_head.qweight` and drops `lm_head.weight`, ...
Load this checkpoint with `GPTQModel.load` or vLLM.
vLLM cannot load the checkpoint. The looper adds the same implicit head override for every method: dynamic = {"lm_head": {"bits": 8, "group_size": 32, ...}}. AWQ honors it, so the head is packed as 8-bit, g32 AWQ:
lm_head.qweight [2048, 8000] lm_head.qzeros [64, 8000] lm_head.scales [64, 32000] (TinyLlama, vocab 32000)
quantization_config: {'bits': 4, 'group_size': 128, 'lm_head': True, 'quant_method': 'awq', 'zero_point': True,
'dynamic': {'lm_head': {'bits': 8, 'group_size': 32, 'sym': True, 'desc_act': False}}, ...}
vLLM's AWQ config (AutoAWQConfig) does not read dynamic at all, and supports only 4-bit AWQ. It builds the quantized ParallelLMHead from the global 4-bit/g128 settings, and weight loading fails on the shape check:
vllm/model_executor/layers/vocab_parallel_embedding.py", line 514, in weight_loader
assert loaded_weight.shape[output_dim] == (
AssertionError
RuntimeError: Engine core initialization failed.
The same config with the head pinned to the global settings (dynamic={"lm_head": {"bits": 4, "group_size": 128}}) loads in vLLM on AutoAWQMarlinLinearMethod and matches GPT-QModel. So the only problem is the implicit 8-bit/g32 head default, which no AWQ consumer except GPT-QModel can represent. GPT-QModel's own 8-bit AWQ warning notes that vLLM cannot decode 8-bit AWQ correctly. That warning checks only the global bits, so it does not fire here. The dynamic-AWQ warning that does fire mentions only Transformers.
Introduced by
Pre-existing. The implicit head override ({"bits": 8, "group_size": 32, ...}) dates from 7939d1a (#1302), when it applied to GPTQ only, where vLLM honors dynamic. lm_head=True for AWQ, together with the "Load this checkpoint with GPTQModel.load or vLLM" save warning (85f18c0, #4034), combines it with a format whose external loaders ignore dynamic. Still present at HEAD 9123364.
Location
gptqmodel/looper/module_looper.py:2189-2193 (HEAD 9123364), method-agnostic:
lm_head_quant_config = {"bits": 8, "group_size": 32, "sym": True, "desc_act": False, "mse": 2.4}
if self.gptq_model.quantize_config.dynamic is None:
self.gptq_model.quantize_config.dynamic = {self.gptq_model.lm_head: lm_head_quant_config}gptqmodel/models/writer.py:340-346 (save warning recommending vLLM for any lm_head=True checkpoint) and :359-369 (the 8-bit AWQ warning only checks quantize_config.bits == 8).
Reproduction (ran it: RTX 4090, GPT-QModel HEAD 9123364, vLLM 0.34.0)
from datasets import load_dataset
from gptqmodel import GPTQModel, AWQConfig, CalibrationConfig
ds = load_dataset("allenai/c4", data_files="en/c4-train.00001-of-01024.json.gz", split="train")
calib = [r["text"] for r in ds.select(range(512)) if len(r["text"]) > 300][:128]
m = GPTQModel.load("TinyLlama/TinyLlama-1.1B-Chat-v1.0", AWQConfig(bits=4, group_size=128, sym=False, lm_head=True))
m.quantize(CalibrationConfig(dataset=calib, batch_size=4))
m.save("tinyllama-awq-lmhead")from vllm import LLM
LLM(model="tinyllama-awq-lmhead", enforce_eager=True, max_model_len=2048)
# AssertionError in vocab_parallel_embedding.weight_loader -> Engine core initialization failedWikitext-2 test PPL (20 x 512 tokens):
| config | vLLM | GPT-QModel |
|---|---|---|
AWQConfig(..., lm_head=True) (implicit 8-bit g32 head) |
crash at engine init | 12.206 |
same + dynamic={"lm_head": {"bits": 4, "group_size": 128}} |
12.289 (AutoAWQMarlinLinearMethod) |
12.295 |
GPTQ GPTQConfig(..., lm_head=True) (same implicit rule, honored by vLLM's GPTQ loader) |
12.334 | 12.336 |
Expected vs actual
Expected: an AWQ checkpoint that GPT-QModel tells the user to load in vLLM loads in vLLM. Actual: the implicit head override produces an 8-bit/g32 AWQ head, which vLLM's AWQ path cannot express, and engine start fails.
Suggested fix
For AWQ, default the implicit lm_head rule to the global bits/group_size (or to 4-bit, the only AWQ width vLLM/SGLang/AutoAWQ read), since AWQ consumers ignore dynamic. At minimum, make hf_compat_warnings stop recommending vLLM for AWQ checkpoints whose head (or any module) uses a dynamic width/group different from the global one, and extend the 8-bit AWQ warning to per-module 8-bit overrides.
Activity
fix(looper): key the implicit lm_head rule per engine prefix and drop…
fix(looper): key the implicit lm_head rule per engine prefix, and dro…