Reland PR #4040: Support Qwix quantization on NNX with cross-environment import compatibility#4198
Merged
Merged
Conversation
8b35a12 to
a1e7fdc
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
igorts-git
approved these changes
Jun 18, 2026
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.
Description
This PR relands the changes from PR #4040 ("Support Qwix quantization on NNX") which was previously merged and reverted.
To prevent import failures across different environments, this PR introduces a dual-compatible fallback import block for
flax_utilinsrc/maxtext/layers/quantizations.py.Context & Why:
The original PR used
from qwix._src import flax_util.Due to a packaging layout discrepancy, different builds/distributions of the Qwix package even within the exact same version identifier (e.g.,
0.1.6) present different internal path structures (some placingflax_utildirectly inqwix._srcand others placing it underqwix._src.utils).Using a single hardcoded path caused immediate compile/import errors depending on the specific package layout present in the target environment.
Solution:
We introduce a try-except fallback block:
This allows the codebase to compile and run correctly across environments with different packaging layouts of the Qwix package.
FIXES: #4040
Tests
The changes were verified by running the unit test suite in the local environment:
Output:
8 passed, 16 skipped in 2.90s(0 failures).Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.