Repository navigation
fix(config): serialize true_sequential so it round-trips (#4382) - #4407
Merged
Merged
Conversation
to_dict() omitted true_sequential, so a config built with true_sequential=False reloaded as the class default True through both QuantizeConfig(**cfg.to_dict()) and from_quant_config(). Write it into the shared meta payload (the reader already lifts it) so every concrete config class round-trips it.
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.
Fixes #4382.
Problem
BaseQuantizeConfig.to_dict()never serializedtrue_sequential. The field's class default isTrue, so a config saved withtrue_sequential=Falsereloaded through eitherQuantizeConfig(**cfg.to_dict())orfrom_quant_config()silently switched back to the defaultTrue, changing calibration/quantization ordering.Fix
BaseQuantizeConfig.to_dict()now writesmeta.true_sequential. The existing_SERIALIZED_META_FIELD_NAMESallowlist already lifts that key back onto the config, so both reload paths preserve the value. Putting it in the shared base serializer covers every concrete config class, not justGPTQConfig.Tests
tests/test_config_serialization_roundtrip_4201.py:Falseand defaultTruethrough bothQuantizeConfig(**d)andfrom_quant_config(d).tests/qcfg/test_config_serialization.py: parametrized over all 12 concrete config classes.True).tests/test_config_serialization_roundtrip_4201.py tests/qcfg/test_config_serialization.py→ 59 passed; broader targeted config/serialization batch → 113 passed, 10 skipped.ruff checkon changed files → clean.Residual risk
meta.true_sequentialnow appears in every config'sto_dict()/save_pretrained()output, including weight-only methods where it is inert. This matches whatmodels/writer.pyalready records, but an external golden-file comparison of olderquantize_config.jsonartifacts would see the extra key.True, unchanged.