Files
Pascal LinxweilerandClaude Opus 5.5 1834792bb8 lfm3: add INT4, FP8 per-channel and VL notes, tests, eval and results
Sync the repo with the working directory: full NOTES.md (rounds 4-5, LFM3-VL),
VL tests and test images, quality eval, AutoRound W4A16 quantization scripts
and calibration recipe, the variant.sh MODEL/DOCKER_ENV options, and the
remaining benchmark results. Large regenerable artifacts (INT4 checkpoint,
ref_vl.pt, raw logprob dumps) stay out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 13:59:43 +01:00

17 lines
851 B
Python

# Verify the per-layer-type forward patch in quantize_autoround.py leaves the model's logits unchanged.
import runpy, sys, torch
sys.argv = ["x", "/model", "/quant/calib/calib_256x2048.pt", "/tmp/unused"]
src = open("/quant/quantize_autoround.py").read().split("t0 = time.time()")[0] # setup + patch, no quantization
g = {"__name__": "check"}
from transformers import AutoModelForCausalLM
ref = AutoModelForCausalLM.from_pretrained("/model", dtype=torch.bfloat16, trust_remote_code=True).to("xpu").eval()
x = torch.load("/quant/calib/calib_256x2048.pt")[3][:, :1000].to("xpu")
with torch.no_grad():
a = ref(x).logits.float()
del ref
exec(src, g)
m = g["model"].to("xpu").eval()
with torch.no_grad():
b = m(x).logits.float()
print("max |dlogit|", (a - b).abs().max().item(), "top1 agree", (a.argmax(-1) == b.argmax(-1)).float().mean().item())