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 #4307. A one-shot iterable (generator) passed as
quantize()calibration data failed withValueError: Quantize: calibration dataset is empty.whenever the run plan had both a native and an EoRA step (GPTAQ or a LoRA/EoRA adapter).list(texts)worked because the list can be iterated again.Root cause
BaseQModel._quantize_with_calibration()builds a separateCalibrationConfigfor theNATIVEstep and for theEORAstep, and eachLoopProcessor.__init__re-runsprepare_dataseton its raw input. #4192 (b7a352f) only normalised the prepared result; the raw generator is exhausted by the first processor, so the second one receives nothing.What Changed
gptqmodel/looper/loop_processor.py: add_reusable_calibration_dataset(). It materialises only plain one-shot iterators (iter(obj) is obj, e.g. generators), returns sized containers untouched (no unnecessary copy), and leavesdatasets.IterableDatasetlazy because it yields a fresh iterator.gptqmodel/models/base.py: in_quantize_with_calibration(), normalisecalibrationandadapter_calibration_datasetonce, before the native and EoRACalibrationConfigs are built and shared with their processors.Tests
New
tests/test_generator_calibration_4307.py(tiny locally-built Llama, CPU, no downloads):GPTAQConfigquantizes successfully (NATIVE + EORA).Lora(rank=4)produces EoRA adapters.adapter_calibration_datasetwith a LoRA adapter works._reusable_calibration_datasetreturns a sized list by identity, materialises a generator, passesNonethrough, and keeps an HFIterableDatasetlazy.Both end-to-end cases fail on unpatched
base.pywithValueError: Quantize: calibration dataset is empty.and pass with the fix.Fixes #4307