Repository navigation
[Fix] Drop the shadowed copies of the lm_head quant-method helpers - #39707
Open
JasonKeyiL wants to merge 1 commit into
Open
JasonKeyiL wants to merge 1 commit into
JasonKeyiL wants to merge 1 commit into
Conversation
`logits_processor.py` defines `_has_lm_head_runtime_attrs` and `should_apply_lm_head_quant_method` twice at module level. Python binds the later definition, so the pair near the top of the file has never run. The duplication came in with the rebase in sgl-project#35758 (2026-08-28), which left the file with two copies of each. Three days later sgl-project#35120 added the NVFP4 W4A16 branch to the copy that Python actually binds, and the two diverged: the shadowed `should_apply_lm_head_quant_method` has no `quant_mode == "w4a16"` branch, so it answers False for a w4a16 lm_head that the live copy accepts. Reading the top of the file now gives the wrong answer about which layouts are supported, which matters because this is the predicate that decides whether a draft model may reuse a quantized target lm_head. `ast.unparse` of the two `_has_lm_head_runtime_attrs` bodies is identical, so that one is pure duplication. Remove the shadowed pair. The surviving definitions are identical under `ast.unparse` to the ones Python already binds on main, so behavior does not change.
JasonKeyiL
requested review from
BBuf,
Edwardf0t1,
Fridge003,
HaiShaw,
Ying1123,
ch-wan,
ispobock and
merrymercy
as code owners
September 16, 2026 04:19
Author
|
Could someone add the It is a pure deletion of two module-level definitions Python never binds; |
3 of 5 tasks
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.
Motivation
logits_processor.pydefines_has_lm_head_runtime_attrsandshould_apply_lm_head_quant_methodtwice at module level, at lines 123/127 and 1230/1234. Python binds the later definition, so the pair near the top of the file has never run.The two copies are no longer the same. The duplication came in with the rebase in #35758 (2026-08-28), which left the file with two copies of each. Three days later #35120 added the NVFP4 W4A16 branch to the copy Python actually binds, and only to that one:
So the shadowed copy answers
Falsefor a w4a16 lm_head that the live one accepts. This is the predicate that decides whether a draft model may reuse a quantized target lm_head, and reading the top of the file currently gives the wrong answer about which layouts are supported.ast.unparseof the two_has_lm_head_runtime_attrsbodies is identical, so that one is pure duplication.Modifications
Remove the shadowed definitions at 123 and 127. Nothing else changes.
Accuracy Tests
No behaviour change, and there is nothing new to test: the definitions that survive are the ones Python was already binding.
Verified rather than assumed:
test/registered/unit/spec/test_eagle_draft_extend_logits.pypasses locally (5 tests), andshould_apply_lm_head_quant_methodstill imports and evaluates as before.black --checkandisort --check-onlyare clean.Verified on macOS/arm64, Python 3.13, CPU only.
Checklist
CI States
Latest PR Test (Base): ❌ Run #35055132838
Latest PR Test (Extra): ❌ Run #35055132737
Latest PR Test (AMD ROCm 10): ❌ Run #35055132762