Repository navigation
Description
Found on main @ 4f287eb, CPU (x86_64), datasets with pyarrow/pandas installed.
What is wrong
prepare_calibration_dataset (gptqmodel/utils/calibration.py:436-437) turns an HF Dataset into rows with list(calibration_dataset). What iteration yields depends on the dataset's format, which is a property the user set earlier (often for another pipeline step):
ds.with_format("pandas"): iteration yields one-rowpandas.DataFrames.ds.with_format("arrow"): iteration yields one-rowpyarrow.Tables, andds.with_format("arrow")[:]is apyarrow.Table(not aMapping, and it has noto_dict, so_frame_columnsdoes not pick it up).
None of these reach a supported row type, so quantize() rejects a plain HF Dataset (the documented input type) based only on its output format. #4652 fixed with_format("numpy")[:] and top-level DataFrames, but not these formats. torch, numpy, python and their [:] slices all work and give the expected tokens.
Repro (prep level; same result through quantize(CalibrationConfig(dataset=...)))
from datasets import Dataset
from gptqmodel.utils.calibration import prepare_calibration_dataset
ds = Dataset.from_dict({"text": texts}) # 3 English sentences
ids = ds.map(lambda x: tok(x["text"])).remove_columns(["text"])
for d in (ds, ids):
for fmt in ("torch", "numpy", "python", "pandas", "arrow"):
prepare_calibration_dataset(q, d.with_format(fmt))
prepare_calibration_dataset(q, d.with_format(fmt)[:])Dataset[text].with_format(torch) OK (and numpy/python, and their [:])
Dataset[text].with_format(pandas) EXC ValueError: Quantize: unsupported calibration example type <class 'pandas.DataFrame'> at index 0.
Dataset[ids].with_format(pandas) EXC ValueError: Quantize: unsupported calibration example type <class 'pandas.DataFrame'> at index 0.
Dataset[text].with_format(arrow) EXC ValueError: Quantize: unsupported calibration example type <class 'pyarrow.lib.Table'> at index 0.
Dataset[text].with_format(arrow)[:] EXC ValueError: Quantize: unsupported calibration example type <class 'pyarrow.lib.ChunkedArray'> at index 0.
Dataset[ids].with_format(arrow) EXC ValueError: Quantize: unsupported calibration example type <class 'pyarrow.lib.Table'> at index 0.
Dataset[ids].with_format(arrow)[:] EXC ValueError: Quantize: unsupported calibration example type <class 'pyarrow.lib.ChunkedArray'> at index 0.
(Same with the Qwen2.5 and Llama-3.2 tokenizers; with_format("pandas")[:] works because it is a top-level DataFrame.)
Suggested fix
For an HF Dataset/IterableDataset, iterate calibration_dataset.with_format(None) (python rows), whatever format the caller left on it. For a top-level pyarrow.Table, use table.to_pydict() in _frame_columns. The VLM splitter (models/definitions/_vlm_calibration.py:219-224) goes through the same helpers, so it is fixed by the same change.
Test that should have caught it
tests/test_calibration_mapping_input.py / tests/test_calibration_input_gaps_4311.py: parametrize over Dataset.with_format(fmt) for every datasets format (None, torch, numpy, pandas, arrow), both iterated and sliced.
Severity
Low. The failure is loud and with_format(None) works around it, but an HF Dataset is the primary documented calibration input and the rejection depends only on its display format.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-11788dff99fdfinished this issue.Pull request: #4902
calibration: iterate HF datasets through with_format(None) and accept a top-level pyarrow Table via to_pydict, so only the caller's display format differs; parametrized test over every datasets format
fix(calibration): accept an HF Dataset whatever display format it car…