Skip to content

[BUG] Low-severity dequant/export/VLM-calib issues: VLM calibration rejects harmless metadata columns (regression from df6c9e6), export(..., "hf") always writes bf16, torch.dequantize_model builds dense Linear on CPU #4455

Closed

Description

@Qubitium

Severity: low. Confirmed at 489aed6.

1. VLM calibration now rejects pre-tokenized rows that carry metadata columns

Kind: regression from df6c9e6 (#4371).

from gptqmodel.models.definitions._vlm_calibration import split_calibration_dataset
split_calibration_dataset([{"input_ids": [1, 2, 3, 4], "attention_mask": [1, 1, 1, 1], "id": 7, "url": "x"}], label="Qwen2VL")
# ValueError: non-text column(s) ['id', 'url']      (def6e61: accepted as pre-tokenized)

This is the usual output shape of a datasets.map(tokenize) that kept its original columns. _TEXT_ONLY_COLUMNS is an allow-list. Rejecting known multimodal keys (pixel_values, image_grid_thw, ...) or tensor-valued unknown keys would keep the #4371 protection without breaking these rows. The intended rejection of pixel_values works.

2. GPTQModel.export(ckpt, out, "hf") always writes bf16

utils/model_dequant.py:1969 defaults to dequantize_model(target_dtype=torch.bfloat16), and models/auto.py:1204 doesn't pass the checkpoint dtype. An fp16 GPTQ checkpoint (config dtype float16, F16 tensors) is exported with config dtype bfloat16 and BF16 tensors. Expected: keep the source dtype. Not A/B-tested.

3. nn_modules.qlinear.torch.dequantize_model always creates the dense Linear on CPU

nn_modules/qlinear/torch.py:1098 does .to("cpu", target_dtype). On a CUDA-loaded model, the next forward fails with a device mismatch. Same at def6e61.


Found during an AI-assisted review (Claude Code, round 13) of 489aed6; repros were run at that commit (A/B against def6e61 where noted) 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

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions