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>
This commit is contained in:
1 parent
0412bb1f72
commit
1834792bb8
67 files changed
+119589
-9
No files matched your search
@@ -0,0 +1,18 @@
|
||||
"""Precision baseline: Liquid's vision tower + projector in BF16 (CPU) vs the fp32 reference outputs."""
|
||||
import sys, torch
|
||||
from transformers import AutoModelForImageTextToText
|
||||
ref = torch.load(sys.argv[2], weights_only=False)
|
||||
m = AutoModelForImageTextToText.from_pretrained(sys.argv[1], trust_remote_code=True, dtype=torch.bfloat16,
|
||||
attn_implementation="sdpa").eval()
|
||||
for name, r in ref.items():
|
||||
if "pixel_values" not in r:
|
||||
continue
|
||||
with torch.no_grad():
|
||||
vis = m.model.vision_tower(r["pixel_values"].bfloat16(), grid_thw=r["image_grid_thw"], return_dict=True).last_hidden_state
|
||||
proj = m.model.multi_modal_projector(vis)
|
||||
out = {}
|
||||
for key, mine, theirs in (("vision", vis, r["vision_out"]), ("projector", proj, r["proj_out"])):
|
||||
mine = mine.float()
|
||||
out[f"{key}_max_abs_diff"] = round(float((mine - theirs).abs().max()), 4)
|
||||
out[f"{key}_cos_min"] = round(float(torch.nn.functional.cosine_similarity(mine, theirs, dim=-1).min()), 4)
|
||||
print(name, out, flush=True)
|
||||
Reference in new issue
Block a user