Repository navigation
Tests: tensor parallel parity for gated-query attention (Qwen3.5); skip missing model types before the ranks start - #17870
Merged
Merged
Conversation
…o_proj
Qwen3.5 / Qwen3-Next / Qwen3.5-MoE attention has q_proj emit [query | gate] per head (2 * head_dim rows each)
while o_proj reads one head_dim per head. _attention_sizes divided the q_proj rows by head_dim, so the plan
recorded twice the heads and set each rank's num_attention_heads to 4 where it held 2, and the first
forward under UNSLOTH_TP_SIZE=2 crashed in SDPA ('size of tensor a (2) must match ... (4) at dimension 1'),
on Kaggle 2xT4 and on gloo CPU alike. Contiguous row shards already hold whole [query | gate] blocks, so
only the count changes. The gloo cross-architecture parity test gains a tiny qwen3_5_text (one Gated
DeltaNet layer, one gated attention layer): crash before, loss equal and grads within 1e-6 of one process
after.
… lacks before the ranks run build() calls pytest.skip for a missing model type; inside a spawned gloo rank that Skipped (a BaseException) escaped _case_tp's per-architecture except and killed both ranks, so on transformers < 5.2 the new qwen3_5_text case turned every tensor parallel test of the module into 'rank exit codes [1, 1]'. The case now records the skip in the parent's result and the test skips.
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…nt supersedes this one) [skip ci]
danielhanchen
added a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Nov 16, 2026
Final comment pass for recently merged PRs. Trims comments added by unslothai#17660, unslothai#17806, unslothai#17807, unslothai#17808, unslothai#17812, unslothai#17830, unslothai#17854, unslothai#17857 and unslothai#17870 that are still on main. Multi-line explanations are collapsed to one line, and comments that restate the code are removed. Comments that explain a version quirk or a correctness trap are kept, along with license headers and pragmas. Changed comment lines: unslothai#17660 5 -> 2, unslothai#17806 4 -> 2, unslothai#17808 1 -> 0, unslothai#17830 3 -> 1, unslothai#17857 1 -> 0. unslothai#17807, unslothai#17812, unslothai#17854 and unslothai#17870 are unchanged. Overall: 6 files, 14 lines removed, 5 added. Only comments change: the AST check (comment_tools.py check) and the pre-push gate both pass.
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.
Test coverage for tensor parallel on gated-query attention (Qwen3.5 / Qwen3-Next), plus a test-harness fix. The product fix itself landed on main in #17785, which counts gated-query heads from the config. This PR now only adds tests.
What the tests pin
tests/test_parallel_general_gloo.py) gains a tinyqwen3_5_textcase, with one Gated DeltaNet layer and one gated attention layer.q_projemits[query | gate]per head. Before the fix, the plan recorded twice the heads, andUNSLOTH_TP_SIZE=2crashed in SDPA on the first forward. That crash reproduced on Kaggle 2xT4 and gloo CPU. With main's head count, the loss matches one process and grads are within 1e-6.Results
transformers 5.22.1:
-k qwen3_5passes on current main.