Skip to content

[BUG] A one-shot iterable (generator) as calibration data fails with GPTAQ or LoRA/EoRA: "calibration dataset is empty" (incomplete fix of #4192) #4307

Closed

Description

@Qubitium

Severity: medium. Status: confirmed end-to-end on opt-125m. Kind: incomplete fix of #4192 (b7a352f).

Where

  • gptqmodel/models/base.py:2655 (NATIVE step) and :2667 (EORA step) both pass the same raw calibration object to separate CalibrationConfigs.
  • Each LoopProcessor.__init__ (looper/loop_processor.py:470-492) re-runs prepare_dataset on that raw input.
  • b7a352f only made the prepared result sized. A generator is used up by the first processor, so the second processor receives nothing.

Repro

from gptqmodel import GPTQModel, QuantizeConfig
from gptqmodel.quantization.config import GPTAQConfig
texts = [f"The quick brown fox number {i} jumps over the lazy dog." for i in range(16)]
m = GPTQModel.load("facebook/opt-125m", QuantizeConfig(bits=4, group_size=128, gptaq=GPTAQConfig()))
m.quantize((t for t in texts), batch_size=4)
# The same failure happens with QuantizeConfig(bits=4, group_size=128) + quantize(..., adapter=Lora(rank=4, path=out_dir))
  • Actual: ValueError: Quantize: calibration dataset is empty., raised from gptq_processor.__init__ → prepare_calibration_dataset. Passing list(texts) instead succeeds.
  • Expected: materialise unsized input once in quantize(), or prepare it once and share the result between processors.
  • Not affected: HF IterableDataset, because it can be iterated again.

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. self-assigned this
    on Nov 16, 2026
  3. 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.

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