-
Notifications
You must be signed in to change notification settings - Fork 185
fix: preserve mtp.* tensors for dense Qwen3.5/Qwen3.6 models #2869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
erm14254
wants to merge
1
commit into
ModelCloud:main
Choose a base branch
from
erm14254:fix-qwen35-mtp-preservation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from gptqmodel.models.definitions.qwen3_5 import Qwen3_5QModel | ||
| from gptqmodel.models.definitions.qwen3_5_text import Qwen3_5TextQModel | ||
|
|
||
|
|
||
| def test_qwen3_5_preserves_mtp_out_of_model_tensors(): | ||
| assert Qwen3_5QModel.out_of_model_tensors == {"prefixes": ["mtp"]} | ||
|
|
||
|
|
||
| def test_qwen3_5_text_preserves_mtp_out_of_model_tensors(): | ||
| assert Qwen3_5TextQModel.out_of_model_tensors == {"prefixes": ["mtp"]} | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two tests are testing code you have written, not the actual execution effects of the code. We need to test the codes actually fixes the bug.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay here is some context, with GPTQModel 7.1.0-dev here is what happens:
Qwen3.6-27B: MTPs gets dropped and you end up with a GPTQ with 0 MTPs.
Qwen3.6-35B-A3B: MTPs get detected and imported successfully, with the informational message that says:
INFO Model: Merged 19 tensors with prefixes ['mtp.'] into the stateSo basically, whatever it is that "qwen3_5_moe.py" and "qwen3_5_moe_text.py" are doing that "qwen3_5.py" and "qwen3_5_text.py" aren't, well it is clearly working:
According to
model.safetensors.index.jsonthis is the distribution of MTPs in Qwen3.6-35B-A3B:But beside that, okay sure I’ll update the test to use a tiny synthetic checkpoint folder with a "model-auxiliary.safetensors" file containing both an
mtp.*tensor and a non-MTP tensor, then run the same prefix-normalization and merge helper used by the save path. That should verify that the dense Qwen3.5/Qwen3.6 definitions actually causemtp.*tensors to be merged into the saved state dict, instead of just checking that the attribute exists.Covers both
Qwen3_5QModelandQwen3_5TextQModel, here you go the new test file: test_qwen3_5_mtp.pyDownload it and run the tests you want, let me know if you need anything else or if you have more questions, thanks!