Repository navigation
Capability registry: refuse tensor parallel where tp_native cannot shard, and add the zoo MoE families - #16709
Merged
Merged
Conversation
…ard, and add the zoo MoE families The registry answered "unverified, tensor parallel MoE runs" for OLMoE (its q / k norms cover all heads' features) and DeepSeek-V3 (multi-head latent attention), while models/tp_native.py always refuses both before any weight loads. query_from now asks tp_native (derive_tp_plan on a model not split yet) and a new tp x model RULE refuses with tp_native's own reason; the cells notes say so. MOE_FAMILIES gains the 13 families of the zoo MoE matrix, each checked on transformers 5.17 to carry a stacked experts module and a router per layer (olmoe, mixtral, qwen2_moe, qwen3_next, qwen3_vl_moe, llama4, glm4_moe, ernie4_5_moe, nemotron_h, jamba, granitemoehybrid, gemma4, lfm2_moe). A multimodal model's family was its text config's model_type (qwen3_5_moe_text, gemma4_text), so the qwen3_5_moe rows never matched a real Qwen3.5-MoE; the "_text" suffix is dropped.
Codex Review SummaryThis 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. |
Member
Author
|
@codex review |
|
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". |
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.
Summary
Three places where
unsloth/parallel_capabilities.pydisagreed with what the code does. The composition matrix (tiny models, CPU gloo, 2 ranks) found them:UNSLOTH_TP_SIZE=2q_normnormalizes 64 features, not one head)tp x modeland tp_native's reasonMOE_FAMILIES, no MoE rowsqwen3_5_moe_text), so the existing qwen3_5_moe rows never matched a real model_textdropped:qwen3_5_moeChange
Query.tp_blocker.query_fromfills it fromtp_native.derive_tp_plan(model, tp): the ValueError text, or empty. It is asked only of a decoder model tp_native can read that is not split yet; a split model was sharded, and its local shapes are not the model's. It is meta-device safe, since the sharded load already runsderive_tp_planon the meta model.tp x model, "tensor parallel on models tensor parallel has no sharding rule for (multi-head latent attention, a q / k norm over all heads)". The refusal message ends with tp_native's own reason. The existing direct-parameter (attention sinks) RULE is unchanged and still answers first for gpt-oss.MOE_FAMILIESgains the 13 families above. Each was checked on transformers 5.17 to build a stacked experts module ([E, ...]gate_up_proj/down_proj, nemotron_hup_proj/down_proj) and a router per MoE layer._model_traitsdrops a_textsuffix from the family.UNSLOTH_PARALLEL_STRICT=1, the new families (and the*_moe_textconfigs now named by their family) are refused under DDP, FSDP2 or TP alone, since their MoE rows are unverified. Base already refusesqwen3_moethe same way under strict mode. Default mode is unchanged: across 60,528 enumerated queries (every new family, 8 dense families, all 38*_textmodel types, 13 layouts, 4 precisions) no outcome differs from base.Testing
New
tests/test_parallel_capabilities_tp_blocked.py, CPU, meta-device models:check_layoutrefuses withtp x modeland tp_native's reason, nothing loaded (2 params)_textSuites on head, after merging main:
Not covered
UNSLOTH_TP_SIZEenv load path the model is sharded at load, and tp_native refuses there first, so users on that path still see tp_native's ValueError rather than the registry's message. The refusal still happens before any weight loads.