lfm3: round 6 - GPTQ INT4 baked (INT4 lm_head + INT8 embedding)
- quant/gptq_baked/: llm-compressor GPTQ W4A16 body (sequential pipeline, verified equal to the plain forward), B65-style GPTQ INT4 lm_head bake with a small damp/act-order/clipping grid, INT8 per-row embedding, assembly into one compressed-tensors checkpoint (1.155 GB vs 3.46 GB BF16) - plugin: pass quant_config to the token embedding so vLLM's compressed-tensors INT8 embedding path is used; BF16/FP8 greedy output unchanged - tests: INT8 embedding kernel check, quant method dump, head timing, round-6 driver - NOTES: round 6 results (PPL +8.1%, decode 217 t/s = FP8 pc +14%, head bake gives no measurable decode gain on this stack), llama-swap snippet (not applied) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1115927570
commit
38b0e9a345
110 files changed
+118917
-3
No files matched your search
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Print which quantization method / kernel vLLM picked for lm_head, embed_tokens, gate_proj and a
|
||||
body linear of a served LFM3 checkpoint (the server log names the INT4 kernel only once).
|
||||
python3 tests/quant_methods.py MODEL_DIR (inside the image, needs VLLM_ALLOW_INSECURE_SERIALIZATION=1)
|
||||
"""
|
||||
import sys
|
||||
from vllm import LLM
|
||||
|
||||
|
||||
def describe(m):
|
||||
lm, e, attn = m.lm_head, m.model.embed_tokens, m.model.layers[2].self_attn
|
||||
|
||||
def kernel(layer):
|
||||
k = getattr(getattr(layer, "scheme", None), "kernel", None)
|
||||
return f"{type(layer.quant_method).__name__}" + (f" / {type(k).__name__}" if k is not None else "")
|
||||
|
||||
return {"lm_head": kernel(lm), "embed_tokens": kernel(e), "gate_proj": kernel(attn.gate_proj),
|
||||
"qkv_proj": kernel(attn.qkv_proj),
|
||||
"lm_head params": {n: (tuple(p.shape), str(p.dtype)) for n, p in lm.named_parameters()},
|
||||
"embed params": {n: (tuple(p.shape), str(p.dtype)) for n, p in e.named_parameters()}}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
llm = LLM(sys.argv[1], enforce_eager=True, gpu_memory_utilization=0.3, max_model_len=4096)
|
||||
for k, v in llm.apply_model(describe)[0].items():
|
||||
print(f"{k}: {v}")
|
||||
Reference in new issue
Block a user