You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] VLM prepare_dataset overrides still calibrate on a Mapping's key names ("input_ids", "attention_mask"): incomplete fix of #4193 #4308
Severity: medium (silently wrong calibration on popular VLMs). Status: confirmed end-to-end on gemma-3-4b-it and by a unit test of split_calibration_dataset. Kind: incomplete fix of #4193 (842d666).
Where
gptqmodel/models/definitions/_vlm_calibration.py:55: split_calibration_dataset does iter(calibration_dataset).
Every VLM override built on the shared helper iterates the mapping and wraps each key as a one-message chat. Affected: llava, internvl, internvl_chat, base_qwen2_vl (Qwen2/2.5-VL, Qwen2.5-Omni), smolvlm, lfm2_vl, ovis2, minicpmv / minicpm_o / minicpmv_4_6, and Gemma3.
Only Qwen3-VL rejects mappings.
The resulting rows are about 12 tokens, so they pass the default min_length=10 and quantization proceeds silently.
Repro
fromgptqmodelimportGPTQModel, QuantizeConfigm=GPTQModel.load("google/gemma-3-4b-it", QuantizeConfig(bits=4, group_size=128))
enc=m.tokenizer(["The quick brown fox jumps over the lazy dog.", "Another calibration sentence for testing."], padding=True)
out=m.prepare_dataset(enc, batch_size=1, calibration_data_min_length=10) # quantize(enc) uses the same path
Actual: 2 batches, which decode as '<bos><start_of_turn>user\ninput_ids<end_of_turn>…' and '…user\nattention_mask<end_of_turn>…'.
Expected: unpack the columns (or route token-id columns to the base text path), and reject DatasetDicts, as the base helper does.
Also: the helper's is_pretokenized_sample sends rows with extra keys (e.g. token_type_ids) or numpy / 0-D-tensor token ids down the processor path instead of the pre-tokenized path.
Found during an AI-assisted review (Claude Code, round 11) of 842d666; repros were run at that commit on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Taking this. I'll investigate against current main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.
Activity
Qubitium commentedon Nov 16, 2026
Taking this. I'll investigate against current
main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.fix: unpack VLM calibration Mapping columns instead of chat key names (…