Skip to content

[BUG] Calibration input-handling gaps after #4193/#4238: datasets Column dicts rejected, concat path packs pad tokens, pad_token_id=None crash, all-zero additive masks #4311

Closed

Description

@Qubitium

Severity: low. Status: confirmed by unit repros at 842d666.

  1. A columnar dict built from datasets Column objects is not recognised (incomplete fix of [BUG] Passing a Mapping as the calibration dataset (BatchEncoding, dict of columns, DatasetDict) calibrates on the key names #4193).
    • Where: gptqmodel/utils/calibration.py:140-152. _is_batched_column only treats list/tuple, or objects with .ndim, as columns.
    • Cause: in datasets ≥4, ds["col"] returns a datasets.arrow_dataset.Column, so the mapping is treated as a single row.
    • Repro:
      tds = Dataset.from_dict({"text": texts}).map(lambda b: tok(b["text"]), batched=True)
      prepare_calibration_dataset(qm, {"input_ids": tds["input_ids"], "attention_mask": tds["attention_mask"]})
    • Actual: ValueError: Quantize: failed to convert input_ids to tensor for calibration item 0.
    • {"text": ds["text"]} only works because the text branch checks Sequence.
    • Expected: treat any non-str Sequence whose first element is a sequence as a column.
  2. The calibration_concat_size path packs pad tokens.
  3. The concat tail padding uses pad_token_id without a fallback. When the tokenizer's pad_token_id is None it raises TypeError (pre-existing).
  4. An additive or extended mask with no padding is treated as "drop everything".
    • This covers all-zero masks, including the [B,1,1,S] shape.
    • The whole row is removed, and the warning wrongly says "input_ids with length <= 0".
  5. Cosmetic: for a columnar dict, LoopProcessor warns "size should be more than 256. Current: 2" because it counts columns, not rows.

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.

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
  4. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Fixed in PR #4352: #4352

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