Skip to content

fix: accept datasets columns and close calibration input gaps (#4311) - #4352

Merged
Qubitium merged 1 commit into
mainfrom
pr/4311
Nov 16, 2026
Merged

Qubitium merged 1 commit into
mainfrom
pr/4311

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

Five input-handling gaps remained in prepare_calibration_dataset after #4193/#4238. The root cause is that calibration input classification only understood list/tuple/.ndim values (so datasets.arrow_dataset.Column looked like a single row), and the concat path packed rows verbatim after the minimum-length filter instead of stripping masked positions. Separately, the concat tail padding dereferenced pad_token_id=None, an all-zero additive/extended mask was normalized as "drop everything", and the looper size warning measured mapping columns rather than calibration rows.

What Changed

  • _is_batched_column: treat any non-str Sequence whose first element is a sequence as a column, which covers datasets.arrow_dataset.Column; single-row dicts and text columns are unchanged.
  • calibration_concat_size: strip attention-mask-0 positions from every row before packing, so pad ids from tokenizer(texts, padding=True) never enter a concatenated window.
  • Concat tail padding: fall back to eos_token_id, then 0, when pad_token_id is None; the mask still marks the tail as padding.
  • _normalize_attention_mask: an all-zero floating-point or rank>=3 mask means "no padding" and keeps every token; only positions explicitly masked (e.g. negative additive bias) are dropped. The item-level removal warning now says empty/all-padding/too-short instead of the misleading input_ids with length <= N.
  • LoopProcessor size warning: count calibration rows for columnar mappings via calibration_input_row_count instead of counting columns.
  • Regression tests in tests/test_calibration_input_gaps_4311.py (one per defect); updated the one tests/test_prepare_dataset.py expectation that encoded the old "pack masked positions" behavior.

Tests

cd /root/work/gptq-new2/a4311
export GPTQ_BYPASS_SAFETY_CHECKS=1 PYTHONPATH=$PWD CUDA_VISIBLE_DEVICES=
python3 -m pytest tests/test_calibration_input_gaps_4311.py -q
# 5 passed

python3 -m pytest tests/test_calibration*.py tests/test_prepare_dataset.py tests/test_looper_concurrency.py -q
# 136 passed, 4 skipped, 2 failed

The 2 failures are pre-existing and environmental, reproduced on a pristine origin/main archive: tests/test_calibration_data_device.py::test_stage_capture_balanced_mode_empty_filter_fallback and ::test_balanced_mode_fallback_when_input_device_not_in_forward_devices both raise RuntimeError: No CUDA GPUs are available (CPU-only container).

Model Support / Module Plan

N/A — no new model types or registry entries.

Fixes #4311

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

Labels

None yet

Projects

None yet

1 participant