Repository navigation
Conversation
…tiple parameter FQNs are None When multiple parameter FQNs are set to None in FqnToConfig to exclude them from quantization, _fqn_to_config_handler previously called top_level_params.pop(i) using the named_parameters() index i rather than the current list position. When multiple parameters were excluded, popping changed the list size and subsequent pop(i) raised IndexError: pop index out of range. Filter top_level_params using list comprehension to safely remove excluded parameter entries without index mutation bugs. Fixes pytorch#4818 Signed-off-by: Soumyajit Ghosh <[email protected]>
somuai
requested review from
andrewor14,
jerryzh168 and
vkuzo
as code owners
September 15, 2026 04:09
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4901
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Author
|
Gentle check-in on this PR — all CI checks have passed green and the Meta CLA is signed. This cleanly resolves the IndexError reported in #4818 when parameter FQNs are None. Friendly ping for the reviewers (@vkuzo, @andrewor14, @jerryzh168) whenever convenient to review. Thank you! |
This branch has not been deployed
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 #4818
In
_fqn_to_config_handler(torchao/quantization/quant_api.py), when multiple parameter FQNs are set toNoneinFqnToConfigto exclude them from quantization, the previous implementation calledtop_level_params.pop(i):When two or more parameters were set to
None, popping reduced the list size, and subsequentpop(i)calls either targeted the wrong element or failed withIndexError: pop index out of range.Solution
Filter
top_level_paramsvia list comprehension to safely exclude parameters matchingparameter_fqnwithout index mutation side-effects:Test Plan
test_fqn_to_config_multiple_none_parametersintest/quantization/test_quant_api.pyunderTestQuantFlow(CPU-compatible).ruff checkpasses with zero errors.