Repository navigation
fix(calibration): unpack columnar mappings instead of calibrating on keys - #4293
Merged
Merged
Conversation
ZX-ModelCloud
force-pushed
the
fix/4193-calibration-mapping
branch
from
November 16, 2026 07:52
a97b8b1 to
99bdca4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prepare_calibration_dataset()rejected onlystrbefore falling back tolist(calibration_dataset). A top-levelMappingtherefore became its keys:model.quantize(tokenizer(texts))calibrated on"input_ids"/"attention_mask".load_dataset(...)withoutsplit=calibrated on"train"/"validation"/"test".With the default
calibration_data_min_length=10, every row was then dropped and quantization failed with a misleading "every input_ids was shorter than ..." error.Fixes #4193.
Changes
Mappingas calibration input:BatchEncoding/ dict of columns (input_ids,text,messages) is split into one example per row.input_ids, onetext, onemessagesconversation) is kept as one row.DatasetDict-style mapping raises a clearValueErrorlisting the splits and suggestingdataset['train'].ValueErrorwith the keys.ValueError.tests/test_calibration_mapping_input.py.Tests
tests/test_calibration_mapping_input.py: 9 passednormalisation,padding_mask,truncation,windows,data_device,mapping_input,special_tokens_4191): 80 passedruff checkon changed files: cleanBehavior
Before: a top-level mapping was iterated as its keys and those strings were tokenized as calibration text.
After: columnar mappings calibrate on their rows, and split mappings fail early with an actionable error.