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,25 @@
|
||||
"""Plugin's vendored processor (no trust_remote_code) vs Liquid's remote processor: same ids + pixels.
|
||||
python3 check_processor.py mine|ref OUT.pt (run each in its own process; 'ref' does not import the plugin)"""
|
||||
import sys, torch, numpy as np
|
||||
from PIL import Image
|
||||
from transformers import AutoProcessor
|
||||
which, out = sys.argv[1], sys.argv[2]
|
||||
if which == "mine":
|
||||
import vllm_lfm3
|
||||
vllm_lfm3.register()
|
||||
proc = AutoProcessor.from_pretrained("/vl", trust_remote_code=(which == "ref"))
|
||||
print(which, type(proc).__module__, type(proc.image_processor).__module__)
|
||||
rng = np.random.default_rng(0)
|
||||
res = {}
|
||||
for (w, h) in [(640, 480), (100, 60), (2400, 400), (1024, 1024), (1920, 1080)]:
|
||||
img = Image.fromarray(rng.integers(0, 255, (h, w, 3), dtype=np.uint8))
|
||||
msgs = [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "hi"}]}]
|
||||
text = proc.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False)
|
||||
res[(w, h)] = dict(proc(text=text, images=[img], return_tensors="pt"))
|
||||
torch.save(res, out)
|
||||
if which == "mine":
|
||||
ref = torch.load(out.replace("mine", "ref"))
|
||||
for k, a in res.items():
|
||||
b = ref[k]
|
||||
print(k, "grid", a["image_grid_thw"].tolist(), "image tokens", int((a["input_ids"] == 125030).sum()),
|
||||
"ids equal", torch.equal(a["input_ids"], b["input_ids"]), "pixels equal", torch.equal(a["pixel_values"], b["pixel_values"]))
|
||||
Reference in new issue
Block a user