Repository navigation
Conversation
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
Fixes #4308 (incomplete fix of #4193). The VLM
prepare_datasetoverrides built ongptqmodel/models/definitions/_vlm_calibration.pyiterated aMappingcalibration input directly, sotokenizer(texts, padding=True)(BatchEncoding) was split into its key names and each key ("input_ids","attention_mask") was wrapped as a one-message chat. The resulting ~12-token rows passedcalibration_data_min_length=10, so quantization calibrated on the literal strings instead of the sentences.What Changed
_vlm_calibration.split_calibration_datasetnow normalizes aMappinginput exactly likeutils/calibration.prepare_calibration_dataset:BatchEncoding, dict of columns) are unpacked into one mapping per row;DatasetDict-style mappings of dataset splits are rejected with the same actionable error;ValueError._vlm_calibration.is_pretokenized_samplenow:input_idsas pre-tokenized, so extra tokenizer columns such astoken_type_idsstay on the base text path instead of being sent to the processor;gemma3.pynow uses the shared splitter instead of its own duplicated_is_pretokenized_sample+iter()logic (and drops the now-unuseditertools/torchimports).This covers every definition built on the shared helper (llava, internvl, internvl_chat, base_qwen2_vl, base_qwen2_5_omni, smolvlm, lfm2_vl, ovis2, minicpmv / minicpm_o / minicpmv_4_6) plus Gemma3.
Tests
New
tests/test_vlm_mapping_calibration_4308.pypins:prepare_dataset(BatchEncoding)calibrates on the real sentences (processor never loaded);DatasetDictis rejected;token_type_idsand rows of NumPy/0-D-tensor token ids take the pre-tokenized path;split_calibration_datasetmapping behaviour.Fixes #4308