Repository navigation
Align the MXFP4 kernels version message with the version actually enforced - #47565
Closed
guptaishaan wants to merge 3 commits into
Closed
guptaishaan wants to merge 3 commits into
guptaishaan wants to merge 3 commits into
Conversation
The MXFP4 warning and error hardcoded `pip install kernels>=0.12.0`, but the gate is `is_kernels_available()`, which enforces `KERNELS_MIN_VERSION <= version < KERNELS_MAX_VERSION` (0.15.2 / 0.16.0). The literal went stale when the pin was bumped and told users a version the check rejects is acceptable. Derive both messages from the same constants the check uses, matching the wording already used in `hub_kernels.py`, `deepgemm.py`, `finegrained_fp8.py` and `modeling_utils.py`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… them - `is_kernels_available` at, below and above the pinned bounds. - A double-digit-minor case pinned to explicit bounds: `"0.9.0" >= "0.15.2"` holds as a string comparison but not as a version comparison. - The MXFP4 warning and error quote `KERNELS_MIN_VERSION`/`KERNELS_MAX_VERSION` themselves, so the message cannot drift from the check again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: mxfp4 |
Contributor
CI recapDashboard: View test results in Grafana |
Member
|
No code agent PRs from first time contributors! |
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 #47455
Problem. With
kernels==0.16.0installed, MXFP4 warnsMXFP4 quantization requires the `kernels` package: `pip install kernels>=0.12.0`— but 0.16.0 is greater than 0.12.0, so the warning reads as a false positive.Cause. The gate is
is_kernels_available(), which enforcesKERNELS_MIN_VERSION <= version < KERNELS_MAX_VERSION, i.e.0.15.2 <= v < 0.16.0(src/transformers/utils/import_utils.py:144-145, matching thekernels>=0.15.2,<0.16pin insetup.py). So 0.16.0 is genuinely unsupported and the check is right — only the message is wrong. The0.12.0literal atsrc/transformers/quantizers/quantizer_mxfp4.py:131and:147went stale when the pin was bumped in #46039.Fix. Both messages now derive from
KERNELS_MIN_VERSION/KERNELS_MAX_VERSIONand state both bounds, matching the wording already used inhub_kernels.py,deepgemm.py,finegrained_fp8.pyandmodeling_utils.py—quantizer_mxfp4.pywas the only straggler. The pin itself is unchanged, per @vasqu's comment on the issue.No string-comparison bug here:
is_kernels_available(andis_triton_available) parse withpackaging.versionon both sides. Added a guard test anyway, since"0.9.0" >= "0.15.2"holds as a string comparison.Tests. Bounds — below floor / at floor / at ceiling (the reported case) — plus the double-digit-minor case in
tests/utils/test_import_utils.py; message-matches-check intests/quantization/mxfp4/test_mxfp4.py, asserting on the constants rather than copied literals. The latter fails if the source change is reverted.cc @vasqu @MekkCyber
Out of scope, noting it only:
KERNELS_{MIN,MAX}_VERSIONare still a hand-maintained copy of thesetup.pypin, which drifted once before (#43753).