Skip to content

[BUG] VLM calibration silently drops pixel_values / image_grid_thw from processor-produced rows (regression from 2b51d4d, #4311) #4371

Closed

Description

@Qubitium

Severity: low-medium: the calibration data silently changes. Status: confirmed on CPU; A/B tested against 842d666. Kind: regression from 2b51d4d.

Where

gptqmodel/models/definitions/_vlm_calibration.py:39-54 (is_pretokenized_sample). It is used by split_calibration_dataset for qwen2-vl, gemma3, llava, ovis2, minicpm*, lfm2_vl and qwen2.5-omni.

Description

  • Any mapping that contains input_ids is now classified as pre-tokenized text and routed to the base text path.
  • That path keeps only input_ids and attention_mask.
  • So a row produced by processor(text=..., images=...) keeps its image placeholder tokens but silently loses pixel_values.
  • Before 2b51d4d, such a row went to the conversation path and failed loudly.

Repro

import torch
from gptqmodel.models.definitions._vlm_calibration import split_calibration_dataset
row = {"input_ids": [...], "attention_mask": [...], "pixel_values": torch.randn(16, 1176), "image_grid_thw": torch.tensor([[1, 4, 4]])}
split_calibration_dataset([row], label="Qwen2VL")   # then prepare_calibration_dataset(...) on the result
  • Actual (HEAD): the row is classified as pre-tokenized, and the prepared keys are ['attention_mask', 'input_ids'].
  • At 842d666: the row goes to the conversation path, which errors.
  • Expected:
    • Treat a row as pre-tokenized text only when its extra columns are text-only (token_type_ids, labels, …).
    • For rows carrying multimodal tensors, either route them to a path that forwards those tensors, or reject them with a clear error.

Found during an AI-assisted review (Claude Code, round 12) of def6e61; repros were run at that commit (A/B against 842d666 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    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.

  3. self-assigned this
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions