Repository navigation
fix(config): avoid mutating dynamic overrides in to_dict - #3442
Merged
Qubitium merged 1 commit intoOct 26, 2026
Merged
Conversation
to_dict() reused self.dynamic for the serialized payload and then removed adapter keys and serialized bits in place. This dropped per-layer adapter rank overrides from the live config. Serialize a deep copy instead. Signed-off-by: Anh Nguyen (Jerry) <[email protected]>
Qubitium
approved these changes
Oct 26, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
@anh-nguyenn Thank you! LGTM
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 #3440
Summary
BaseQuantizeConfig.to_dict()publishedout["dynamic"] = self.dynamicand then removed"adapter"and rewrote"bits"in each dynamic layer dict in place. Serializing a config therefore mutated the live config and dropped per-layer adapter rank overrides, which breaksextract_adapter_rank_patterns()and any later save/load step that relies on them.What Changed
self.dynamicbefore building the serialized payload, so the in-memory config keeps its adapter overrides.to_dict()leavesqconfig.dynamicandextract_adapter_rank_patterns()intact.Tests
Before the fix (test run against
mainconfig implementation):After the fix:
GPU validation: not applicable. This is a pure config-serialization fix and the regression test is CPU-only.
AI assistance
This PR was prepared with AI assistance (opencode) and reviewed against the repository conventions. There is no AI co-author trailer.
Labels
This account does not have label permissions. Please add the
buglabel (and any required triage labels) when reviewing.