Skip to content

[BUG][model] Most VLM prepare_dataset overrides crash on pre-tokenized calibration rows the public API accepts, and ignore calibration options #4228

Closed

Description

@Qubitium

Severity: low–medium
Version: 7.11.0 @ 9dad249

Summary

Gemma3 (gemma3.py:~284) and Qwen3-VL (base_qwen3_vl.py:~538) route token-id rows to the base text path. The other VLM overrides send them to processor.apply_chat_template:

  • base_qwen2_vl.py:~340 (also Qwen2.5-VL / Qwen2.5-Omni)
  • internvl.py:~133, ovis2.py:~98, lfm2_vl.py:~131, smolvlm.py:~101, llava.py:~112
  • MiniCPM-V and InternVL-chat

They also silently ignore calibration_concat_size, calibration_sort and calibration_data_min_length.

Reproduce (tiny Qwen2-VL, CPU)

m = GPTQModel.load(tiny_qwen2_vl, QuantizeConfig(bits=4, group_size=32, device="cpu"))
m.quantize([ids, ids])                                               # AttributeError: 'int' object has no attribute 'get'
m.quantize([{"input_ids": ids, "attention_mask": [1] * len(ids)}])   # KeyError: 'content'

Expected

A pre-tokenized fallback to the base path, as Gemma3 / Qwen3-VL do, or a clear error. Calibration options should be honoured or rejected explicitly.


Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugmodel

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions