Skip to content

fix: SequentialQuantizer children no longer match singular wildcards via fused-experts normalization#1911

Open
arham766 wants to merge 1 commit into
NVIDIA:mainfrom
arham766:fix/seqquantizer-wildcard-normalization
Open

fix: SequentialQuantizer children no longer match singular wildcards via fused-experts normalization#1911
arham766 wants to merge 1 commit into
NVIDIA:mainfrom
arham766:fix/seqquantizer-wildcard-normalization

Conversation

@arham766

@arham766 arham766 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: Bug fix

Bug 1 in #1902 (regression from #1340): the fused-experts name normalization collapses weight_quantizer.N — exactly a SequentialQuantizer's child names — so sub-quantizers matched *weight_quantizer on their own. Consequences reproduced: re-applying a list config nests SequentialQuantizers inside sub-slots (corrupt state), and set_quantizer_attributes_partial with a list + wildcard raises mid-iteration against its own docstring. Fix skips the normalized match only when the direct parent is a SequentialQuantizer; raw wildcards, callable filters, and the plural weight_quantizers.N path are unchanged, and all #1340 fused-experts tests still pass. Two regression tests pin idempotent re-application and the docstring's list-on-sequential contract.

Usage

N/A

Testing

Regression tests included (added to existing unit test files; each was verified to fail with the fix reverted). Full tests/unit/torch quantization+export+utils+opt battery passes locally with all sibling fixes applied (962 passed). Note: the test-suite PRs #1903-#1907 contain behavior-documenting NOTE tests that pin the OLD behavior fixed here — whichever lands second will be rebased to flip those assertions (happy to do so).

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅ (error-raising on previously-silent invalid input / warning removal / exception-path cleanup only)
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: ✅
  • Did you update Changelog?: N/A
  • Did you get Claude approval on this PR?: N/A (external contributor)

Additional Information

Issue: #1902

…hing

The fused-experts name normalization from NVIDIA#1340 collapses
weight_quantizer.<N> to weight_quantizer — intended for per-expert
nn.ModuleList layouts, but this is exactly the child naming of a
SequentialQuantizer stored at attribute weight_quantizer. Its children
are TensorQuantizers, so they matched singular wildcards like
*weight_quantizer on their own, with two user-visible consequences:

- applying the same list config twice via set_quantizer_attributes_full
  nested a SequentialQuantizer inside each sub-slot (non-idempotent,
  corrupt state no consumer supports);
- set_quantizer_attributes_partial with a list config and a wildcard
  raised ValueError mid-iteration for targets that are already
  SequentialQuantizers, contradicting its own docstring and leaving the
  model partially configured.

Skip the normalized match when the quantizer's direct parent is a
SequentialQuantizer. Raw wildcard matches (including explicit
*weight_quantizer.0), callable filters, and the plural
weight_quantizers.N fused-experts path are unchanged; the parent lookup
only runs when the raw match already failed.

Part of the findings in NVIDIA#1902.

Signed-off-by: arham766 <arhamislam766@yahoo.com>
@arham766 arham766 requested review from a team as code owners July 5, 2026 20:40
@arham766 arham766 requested a review from cjluo-nv July 5, 2026 20:40
@copy-pr-bot

copy-pr-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@arham766, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0d0c1dbd-ad8e-4d9d-8b6b-579ff00a5ab3

📥 Commits

Reviewing files that changed from the base of the PR and between b96a785 and 85f82d9.

📒 Files selected for processing (2)
  • modelopt/torch/quantization/conversion.py
  • tests/unit/torch/quantization/test_quantize_cpu.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant