Repository navigation
[models] Split multimodal families into text Decoder and MultimodalModel classes - #6084
Conversation
73c9d2e to
94185ff
Compare
…del classes Each family with modality encoders now has a text-only Decoder subclass and an XMultimodalModel(XModel, MultimodalModel) whose Config requires its encoders: Qwen3.5 (+ qwen3_6/qwen3_8), Kimi K3, Kimi K2.x (new KimiK2Model for Moonlight), Muse Glimmer and Muse Spark. Plain flavors build the text class, _mm flavors the multimodal one. MultimodalModel.Config raises when no encoder is set, so config-driven `vision_encoder is None` branches are removed. RL: build_inference_model's keep_vision_encoder is gone (the generator builds what the config says); the Controller checks vision_processor <-> multimodal generator model in both directions. annotate_input_spmd_types calls annotate_spmd_types() on non-tensor inputs (or the values of a mapping input such as attention_metadata), replacing the per-model linear-attention metadata annotation. Kimi K3, Muse Spark and Muse Glimmer override Decoder.forward_embeddings where their tail differs, and multimodal forwards end in self.forward_embeddings. Kimi K3 drops its replicated-parameter annotation override.
98d1ebc to
8c7f8b7
Compare
|
@claude review |
There was a problem hiding this comment.
Verdict: Approve -- please address the items below before merging -- Splitting each family into text and multimodal classes removes the vision_encoder is None branches and keep_vision_encoder, which were driven by config. Numerics are bitwise equal for every family except Moonlight, and the description misstates how Moonlight changes. A maintainer still needs to review, because this touches shared code (spmd_types.py, multimodal.py, the RL controller and generator).
What this PR does. Each family that has encoders (Qwen3.5, Kimi K3, Kimi K2.x, Muse Glimmer, Muse Spark) now has a text Decoder subclass and a multimodal subclass whose config requires at least one encoder. Text flavors build the text class. The RL generator builds exactly what the config says, and Controller.Config checks vision_processor against the model type in both directions. annotate_input_spmd_types now also annotates any non-tensor input that defines annotate_spmd_types(), including values inside mappings such as attention_metadata.
Example.
# main
build_model_config("9B") # Qwen35Model.Config(vision_encoder=None), a MultimodalModel
replace(build_model_config("9B_mm"), vision_encoder=None) # accepted
# this PR
build_model_config("9B") # Qwen35Model.Config (Decoder, no encoder field)
replace(build_model_config("9B_mm"), vision_encoder=None) # ValueError in __post_init__
# Moonlight: KimiK25Model(vision_encoder=None) -> KimiK2Model(DeepSeekV3Model)Must fix
- The "Summary (human-written)" section is empty: only the template comment is there. The author needs to write it.
torchtitan/models/kimi_k2_7/model.py:48-- Moonlight's code path changes, contrary to the description ("text path unchanged apart from the class"). It now runsMTPDecoder.preprocess_inputs/forwardand no longer rejects CP. Correct the description; ideally add one Moonlight-shaped run.
Should consider
torchtitan/models/muse_glimmer/flavors.py:386--_model_confighas a single caller and repeats that caller's branch with asserts. Inline it.torchtitan/models/muse_spark/flavors.py:961-- builds a throwawayMuseSparkModel.Configand copies its fields into a second config. Build onefieldsdict instead.torchtitan/distributed/spmd_types.py:216--getattr(item, "annotate_spmd_types", None)is duck typing in a helper every model uses. A smallProtocol(or anisinstancecheck against the metadata base classes) would make the contract explicit. Minor.
Questions
torchtitan/models/muse_spark/model.py:612-- shoulddataset_modalities=()still be allowed on the multimodal config? It keeps the second text-only path that "Alternatives considered" rejects.
Details
- Gate. The problem is real on main. Text flavors are
MultimodalModels whose encoders are None, so callers usegetattr(config, "vision_encoder", None). The split is the minimal explicit fix and moves validation to config time. - Kimi K2.x FSDP. On main, the MRO is
(MultimodalModel, MTPDecoder), soMultimodalModel._apply_fsdpalready calledsuper()intoMTPDecoder._apply_fsdp. Moonlight's FSDP grouping is therefore unchanged. The changes are preprocess/forward and the CP rejection. - The
local_compileTODO onKimiK2Model.Configdocuments a bug that already exists on main (Kimi K2.5 compiles no regions because of the reversed-MRO field resolution). Keeping it out of scope is fine. - spmd_types.
VarlenAttentionMetadataoffsets are now typed for every model ({DP: V, CP: R, TP: R}). That matches the global offsets AllGatherKV uses.AllGatherKVVarlenAttentionMetadata.inverse_permutationstays untyped. - RL. The Controller check is engine-agnostic, so SGLang (which rejects
vision_processor) keeps the guard thatkeep_vision_encoder=Falseused to give it. - Kimi K3. Dropping the
parallelizeoverride is safe forlocal_compile: bothBaseModel.parallelizeandMultimodalModel.parallelizecalllocal_compile.apply().
Not verified: Moonlight and Kimi K2 text numerics, and CP on Moonlight. I also did not check the claim that every Kimi K3 parameter's module has a ShardingConfig; the description says typechecked runs cover it.
|
|
||
|
|
||
| class KimiK25Model(MultimodalModel, MTPDecoder): | ||
| class KimiK2Model(DeepSeekV3Model): |
There was a problem hiding this comment.
The description says Moonlight's "text path [is] unchanged apart from the class", but the code path does change. On main, Moonlight was a KimiK25Model with vision_encoder=None. It ran KimiK25Model.parallelize, which raised NotImplementedError under CP ("vision scatter needs the full sequence"), and also used KimiK25's own preprocess_inputs and forward (embedding under spmd_local_context("dp")).
As a KimiK2Model, Moonlight now gets MTPDecoder.preprocess_inputs/forward, which fall through to Decoder.forward when there are no MTP layers. CP is also no longer rejected. FSDP wrapping is unchanged, since main's MultimodalModel._apply_fsdp already called through to MTPDecoder._apply_fsdp.
Dropping the CP rejection is probably right, because its reason was the vision scatter. But nothing here exercises it: there is no text-only Kimi K2 debug flavor, and the Numerics table has no Moonlight row. Please fix the description to say Moonlight now uses the DeepSeek-V3/MTPDecoder text path and accepts CP. Ideally, also add one small Moonlight-shaped run (e.g. debugmodel built as KimiK2Model) to the numerics table.
| return encoder, adapter | ||
|
|
||
|
|
||
| def _model_config( |
There was a problem hiding this comment.
_model_config has a single caller, _muse_glimmer_config at line 444. That caller already branches on vision_adapter_dim to build vision_projection and perception_emb_norm. The helper then re-derives that branch from vision_encoder is None and asserts the four arguments agree.
Inlining it removes the four asserts and one function. Build the shared fields dict once, then return MuseGlimmerModel.Config(**fields) or MuseGlimmerMultimodalModel.Config(..., **fields) inside the existing if vision_adapter_dim is not None branch. Kimi's _moonlight_16b_a3b_config in this PR already uses this pattern.
|
|
||
| @dataclass(kw_only=True, slots=True) | ||
| class Config(MuseSparkModel.Config, MultimodalModel.Config): | ||
| dataset_modalities: tuple[Literal["vision", "audio"], ...] = () |
There was a problem hiding this comment.
dataset_modalities=() is still allowed on MuseSparkMultimodalModel.Config, and the README documents it as "no media; the encoders are skipped". That keeps a second way to be text-only: a multimodal config whose encoders are built and synced but never run. The "Alternatives considered" section rejects exactly that ("two ways to be text-only").
Should __post_init__ require at least one modality, so that text-only always means MuseSparkModel? Or is there a recipe that trains encoder-carrying checkpoints on text-only data? If such a recipe exists, it is worth naming in the README.
| vision_invariant_linear_sharding_config() | ||
| ), | ||
| ) | ||
| return MuseSparkMultimodalModel.Config( |
There was a problem hiding this comment.
For multimodal flavors, this builds a throwaway MuseSparkModel.Config and copies its fields via dataclasses.fields into a second config. That runs validation twice, and the copy silently depends on the two configs sharing every field.
Building a fields dict once and constructing exactly one config is shorter and states the intent directly. It is the same pattern Kimi's _moonlight_16b_a3b_config uses:
fields = dict(max_context_length=..., tok_embeddings=..., layers=layers, ...)
if audio_encoder is None and vision_encoder is None:
return MuseSparkModel.Config(**fields)
...
return MuseSparkMultimodalModel.Config(**fields, dataset_modalities=..., ...)…ntract - Muse Glimmer: inline the single-caller _model_config; the builder takes vision=(encoder, adapter) and derives vision_projection's input size from the adapter. - Muse Spark: build one fields dict and construct exactly one config, instead of copying a throwaway MuseSparkModel.Config into the multimodal one. - MuseSparkMultimodalModel.Config requires a non-empty dataset_modalities, so text-only training always means MuseSparkModel. - annotate_input_spmd_types checks a runtime-checkable SpmdAnnotatedInput Protocol instead of getattr duck typing. Flavor configs are unchanged (every Glimmer/Spark flavor dumped before and after, TP1 and TP2+EP2+SP).
|
@claude review |
There was a problem hiding this comment.
Verdict: Approve -- please address the items below before merging -- 000bf44 resolves every code item from the previous review. Two small items are left: the human-written summary is still empty, and the new Muse Spark check leaves test_multimodal.py testing a guard that Spark no longer relies on. A maintainer still needs to review, because this touches shared code (spmd_types.py, multimodal.py, the RL controller and generator).
What this PR does. Each family that has encoders (Qwen3.5, Kimi K3, Kimi K2.x, Muse Glimmer, Muse Spark) now has two classes: a text Decoder and a multimodal subclass whose config requires at least one encoder. Text flavors build the text class, and the RL generator builds exactly what the config says. The latest commit inlines the Glimmer and Spark config builders so each builds exactly one config. It also makes MuseSparkMultimodalModel.Config require a non-empty dataset_modalities, and replaces getattr duck typing in annotate_input_spmd_types with a runtime-checkable SpmdAnnotatedInput Protocol.
Example.
build_model_config("9B") # Qwen35Model.Config (Decoder, no encoder field)
replace(build_model_config("9B_mm"), vision_encoder=None) # ValueError, MultimodalModel.Config
# Muse Spark after 000bf44:
replace(spark_mm, dataset_modalities=()) # ValueError, MuseSparkMultimodalModel.Config
replace(spark_mm, vision_encoder=None, audio_encoder=None) # ValueError from either checkMust fix
- The "Summary (human-written)" section is still empty, with only the template placeholder. The author needs to write it.
tests/unit_tests/cpu/models/common/test_multimodal.py:15-- Spark now rejects a config with no encoders by itself, so this test only pins whichValueErrorfires first. Point it at Kimi K3 or Qwen3.5vision_encoder=Noneinstead, whereMultimodalModel.Configis the only guard, and update the Testing bullet in the description (inline suggestion).
Details
- Previous review items at HEAD. Moonlight description: fixed. It now says Moonlight runs
MTPDecoder.preprocess_inputs/forward, accepts CP (untested), and the numerics table has a Kimi K2 text row. Glimmer_model_config: inlined, andvision_projection.in_featuresnow comes fromvision_adapter.c_proj.out_features, the same way Spark does it. Spark throwaway config: replaced by a singlefieldsdict. Duck typing: replaced bySpmdAnnotatedInput.dataset_modalities=(): now raises, and the README and docstring are updated. - Check order in Spark.
MuseSparkMultimodalModel.Configresolves its MRO asMuseSparkModel.Config -> MultimodalModel.Config -> Decoder.Config. Becausesuper().__post_init__()runs first, the generic "needs at least one of" error is raised before Spark'sdataset_modalitieschecks. That ordering is the only reason the current test passes. SpmdAnnotatedInput. Aruntime_checkableisinstanceonly checks that the attribute exists, so behavior is the same as the oldgetattr. The four implementers (attention.py:354,linear_attention.py:51,cp_linear_attention.py:47,90) match the Protocol structurally and need no changes.- RL. The two-way Controller check is engine-agnostic, so engines without a vision processor keep the guard that
keep_vision_encoder=Falseused to give them.
Not verified: the Glimmer and Spark flavor-config equivalence after 000bf44 (the author reports dumping every flavor before and after), and CP on Moonlight.
| def test_multimodal_config_requires_an_encoder() -> None: | ||
| """Muse Spark's encoders are each optional, so MultimodalModel.Config is | ||
| what rejects a multimodal config with none.""" | ||
| config = build_model_config("debugmodel_mm", parallelism=ParallelismConfig()) | ||
| dataclasses.replace(config, audio_encoder=None, dataset_modalities=("vision",)) | ||
| with pytest.raises(ValueError, match="needs at least one of"): | ||
| dataclasses.replace( | ||
| config, audio_encoder=None, vision_encoder=None, dataset_modalities=() | ||
| ) |
There was a problem hiding this comment.
After 000bf44, Muse Spark no longer depends on MultimodalModel.Config to reject a config with no encoders. MuseSparkMultimodalModel.Config.__post_init__ (muse_spark/model.py:621-634) now requires a non-empty dataset_modalities, and it requires an encoder for each listed modality, so Spark already rejects that config by itself. The docstring and the description's Testing bullet ("Muse Spark is the only family where each encoder is optional, so this check is its only guard") are no longer true.
The test now passes only because the MRO runs MultimodalModel.Config.__post_init__ before Spark's own check. Delete the generic check and this still raises ValueError, just with the wrong message: the test pins which error fires first, not that the config is rejected.
The generic check is now the only guard for the families whose encoder field is required but can still be set to None explicitly. That is the replace(build_model_config("9B_mm"), vision_encoder=None) example in the description. Point the test at one of those families instead, e.g. Kimi K3, whose CPU tests already import cleanly:
| def test_multimodal_config_requires_an_encoder() -> None: | |
| """Muse Spark's encoders are each optional, so MultimodalModel.Config is | |
| what rejects a multimodal config with none.""" | |
| config = build_model_config("debugmodel_mm", parallelism=ParallelismConfig()) | |
| dataclasses.replace(config, audio_encoder=None, dataset_modalities=("vision",)) | |
| with pytest.raises(ValueError, match="needs at least one of"): | |
| dataclasses.replace( | |
| config, audio_encoder=None, vision_encoder=None, dataset_modalities=() | |
| ) | |
| def test_multimodal_config_requires_an_encoder() -> None: | |
| """Kimi K3's vision_encoder is its only encoder, so MultimodalModel.Config | |
| is the only check that rejects setting it to None.""" | |
| config = build_model_config("debugmodel_mm", parallelism=ParallelismConfig()) | |
| with pytest.raises(ValueError, match="needs at least one of"): | |
| dataclasses.replace(config, vision_encoder=None) |
This needs from torchtitan.models.kimi_k3 import build_model_config at line 12. Then update the Testing bullet in the description.
Muse Spark now rejects a config with no encoders by itself (dataset_modalities must be non-empty and each listed modality needs its encoder), so the test only pinned which ValueError fires first. For Kimi K3, MultimodalModel.Config is the only check rejecting vision_encoder=None; with it removed, the config is accepted.
|
@claude review |
There was a problem hiding this comment.
Verdict: Approve -- please address the item below before merging -- 73137f0 fixes the test item from the last review. The only item left is the empty human-written summary. A maintainer still needs to review, because this touches shared code (spmd_types.py, multimodal.py, the RL controller and generator).
What changed since the last review. One commit, 73137f0. It points test_multimodal.py at Kimi K3 debugmodel_mm with vision_encoder=None instead of Muse Spark.
Example.
config = kimi_k3.build_model_config("debugmodel_mm", parallelism=ParallelismConfig())
dataclasses.replace(config, vision_encoder=None)
# ValueError: KimiK3MultimodalModel needs at least one of ('vision_encoder',); ...Must fix
- The "Summary (human-written)" section is still empty: it has only the template placeholder. The author needs to write it.
Details
- Previous item,
test_multimodal.py: resolved.KimiK3MultimodalModel.Config(kimi_k3/model.py:316) defines no__post_init__, and neither doesKimiK3Model.Config. SoMultimodalModel.Config.__post_init__(multimodal.py:46-57) is the only check that rejectsvision_encoder=None, and the test fails if that check is removed.multimodal_encoder_fqns = ("vision_encoder",)at line 312 matches the field the test clears. The Testing bullet in the description already names Kimi K3. - All other items from the earlier reviews were resolved at 000bf44 and are unchanged at HEAD.
Not verified: I did not run the test (running tests needs approval in this job), and CP on Moonlight is still untested.
Follow the Kimi K3 split from pytorch#6084: debugmodel and Kimi-K3.1-Pro build the text KimiK31Model, and the _mm flavors build KimiK31MultimodalModel with the vision encoder. kimi_k3_config takes the multimodal config class next to the text one.
Follow the Kimi K3 split from pytorch#6084: debugmodel and Kimi-K3.1-Pro build the text KimiK31Model, and the _mm flavors build KimiK31MultimodalModel with the vision encoder. kimi_k3_config takes the multimodal config class next to the text one.
Follow the Kimi K3 split from pytorch#6084: debugmodel and Kimi-K3.1-Pro build the text KimiK31Model, and the _mm flavors build KimiK31MultimodalModel with the vision encoder. kimi_k3_config takes the multimodal config class next to the text one.
Follow the Kimi K3 split from pytorch#6084: debugmodel and Kimi-K3.1-Pro build the text KimiK31Model, and the _mm flavors build KimiK31MultimodalModel with the vision encoder. kimi_k3_config takes the multimodal config class next to the text one.
Follow the Kimi K3 split from pytorch#6084: debugmodel and Kimi-K3.1-Pro build the text KimiK31Model, and the _mm flavors build KimiK31MultimodalModel with the vision encoder. kimi_k3_config takes the multimodal config class next to the text one.
Follow the Kimi K3 split from pytorch#6084: debugmodel and Kimi-K3.1-Pro build the text KimiK31Model, and the _mm flavors build KimiK31MultimodalModel with the vision encoder. kimi_k3_config takes the multimodal config class next to the text one.
Summary (human-written)
Why
Whether a model has a vision encoder is decided in three places: the flavor
(
vision_encoder=None), the RL generator (keep_vision_encoderinbuild_inference_model, which raises if a text-only engine gets a config withan encoder), and runtime
vision_encoder is Nonebranches inside everymultimodal model.
MultimodalModeldoesn't mean "has encoders": on main, theQwen3.5, Kimi K3/K2.x and Muse Glimmer text flavors are
MultimodalModels withtheir encoders set to None, and the Muse Spark text flavors build both encoders
and skip them with
dataset_modalities=(). So callers fall back togetattr(config, "vision_encoder", None).Example.
What changed
Two classes per family with encoders: a text-only
Decodersubclass anda multimodal subclass of it and
MultimodalModelwhose config requires itsencoders. Text flavors build the text class, multimodal flavors the
multimodal one. The text class is listed first in both the model and
Configbases, because dataclass fields resolve over the reversed MRO (documented in
torchtitan/models/README.md). Kimi K2.5 is the exception, see follow-ups.Qwen35ModelQwen35MultimodalModelKimiK3ModelKimiK3MultimodalModelKimiK2Model(new; Moonlight)KimiK25ModelMuseGlimmerModelMuseGlimmerMultimodalModelMuseSparkModelMuseSparkMultimodalModelFlavor names are unchanged. For Qwen3.5, Kimi K3, Muse Glimmer and Muse
Spark, the plain flavors are text-only and
_mmadds the encoders. Theqwen3_6 / qwen3_8 flavors already carried a vision encoder by default and
stay multimodal.
MultimodalModel.Config.__post_init__raises when no encoder is set.Config-driven
vision_encoder is Nonebranches are removed, including theones guarding main's explicit TP collectives around the vision scatter
(
maybe_gather_tp_input,replicate_to_residual). Runtime None handlingstays where pipeline stages after the first drop the encoders.
Text classes reuse
Decoder.forward/Decoder.preprocess_inputswherenumerically identical. Where the tail after the embedding differs, the model
overrides
Decoder.forward_embeddings: Kimi K3 (attention-residual blocks,keyword-only
block_residual_TND) and Muse Glimmer (blocks without paddingmask or aux-loss denominator) are new, and Muse Spark's override (from [rl] Muse Spark image prompts and a SLAKE LoRA GRPO recipe for Muse Spark 816B #6025)
moves to the text class. Multimodal forwards end with
self.forward_embeddings(...).annotate_input_spmd_types(shared, so it applies to every model) now callsannotate_spmd_types()on non-tensor inputs, or the values of a mapping inputsuch as
attention_metadata, that implement the new runtime-checkableSpmdAnnotatedInputprotocol. This replaces the per-modelGDN/KDA metadata annotation (
annotate_linear_attention_metadata, deleted),and also types full-attention varlen offsets. Checked with spmd typechecking
(see Testing).
Kimi K3 drops its
parallelizeoverride.MultimodalModel.parallelizealready applies activation remat to the encoder, and the override's
annotate_replicated_parameterscall had nothing left to annotate: everyKimi K3 parameter's module has a
ShardingConfig. Typechecked runs passwithout it.
State dict adapters choose the vision mapping by config type. A text flavor
still loads the decoder from the multimodal HF checkpoint.
RL:
keep_vision_encoderis deleted frombuild_inference_model. TheController check is two-way:
vision_processorset requires a multimodalgenerator model with a vision encoder, and a multimodal generator model
requires
vision_processor.Kimi K2.x: Moonlight builds the new
KimiK2Model(DeepSeekV3Model)instead ofKimiK25Model(vision_encoder=None). It keeps Kimi's QK-clip optimizer hookand HF adapter (plain
DeepSeekV3Modelwould silently drop both), and pinslocal_compileto empty to keep Moonlight's current regions (seefollow-ups). Moonlight's code path changes: it now runs
MTPDecoder.preprocess_inputs/forward(with no MTP layers, the plainDecoderpath) instead ofKimiK25Model's, and it no longer rejects CP,since
KimiK25Model's CP rejection is for the vision scatter. Loss andgrad_norm are unchanged (the Kimi K2 text row below); CP on Moonlight is not
tested.
KimiK25Modelnow inheritsDeepSeekV3ModelthroughKimiK2Model(main:MTPDecoder). Its config already derived fromDeepSeekV3Model.Config, andKimiK2Modeloverrides both class attributesDeepSeekV3Modeladds (state_dict_adapter_cls,_register_optimizer_hooks), so behavior is unchanged.Muse Spark behavior change: plain flavors (
debugmodel,816B-A42B) nolonger build the vision/audio encoders, so checkpoints saved from text runs
have no encoder weights, the same trade-off Qwen3.5/Kimi text flavors make.
dataset_modalitiesmoves toMuseSparkMultimodalModel, where it isrequired and must list at least one modality, so text-only training always
means
MuseSparkModel.graph_trainer Muse Glimmer: the text-only check moves from its
Config.__post_init__to itsbuild_model_config, which raises formultimodal flavors.
scripts/checkpoint_conversion/numerical_tests_{qwen3_5,kimi_k3}.pycomparevision parity and now raise a
ValueErrorfor text-only flavors.Mechanical (skim): flavor files,
__init__exports, READMEs, thenumerical_tests_qwen3_5_shard.pyscript, recipes, and test updates thatfollow the class names.
Alternatives considered
isinstance(config, MultimodalModel.Config)without the split: text flavorsare
MultimodalModels today, so it can't tell them apart.vision_encoder: X | Noneand check it everywhere: that's the status quothis removes.
text-only, and the generator would build and sync a 1.85B-parameter vision
encoder it never runs.
User-facing changes
replace(mm_config, vision_encoder=None)allowedValueError; use the text flavorbuild_inference_model(..., keep_vision_encoder=...)vision_processorraises inbuild_inference_modelController.Configraises at config time816B-A42B/debugmodelbuild encoders, skipped viadataset_modalities=()dataset_modalitiesonly on_mmflavors, and empty raisesNumerics
Bitwise-identical loss and grad_norm on all 10 steps vs. main
a1f6dcd25(seed 42, deterministic, flex attention,
scripts/loss_compare.py --export-result/
--import-result --assert-equal, grad_norm compared from TensorBoard at fullprecision). GB300, attn-gym 0.0.18; the four Qwen3.5 configs were rerun on
the pinned attn-gym 0.0.20 and are also bitwise equal.
debugmodeldebugmodeldebugmodel_mmdebugmodel_mmdebugmodeldebugmodel_mmdebugmodel(multimodal)debugmodelwithout its encoder (main:KimiK25Model(vision_encoder=None), as Moonlight; here:KimiK2Model)debugmodeldebugmodel_mmdebugmodeldebugmodel_mmMuse Spark
debugmodelmatches even though it no longer builds encoders: theywere skipped in forward before, received no gradients, and the decoder's init
is unchanged on the meta-device build path.
Not run: Moonlight 16B itself (adapter mapping verified on synthetic state
dicts), CP on Kimi K2 (main rejects it), GPU unit tests.
Testing
debug.spmd_typechecking, 3 steps) passes on Llama 3varlen Ulysses CP2 and TP2 + Ulysses CP2; Qwen3.5 and Kimi K3 multimodal with
all-gather-KV CP2 and Ulysses CP2; Qwen3.5 and Kimi K3 text varlen; Kimi K3
text TP2 + EP2 + SP; Kimi K3 multimodal FSDP2 + TP2 + EP2 + SP.
tests/unit_tests/cpu,tests/rl/unit_tests/cpu): nonew failures vs. main.
expected class;
dataclasses.fieldsdefaults of each multimodalConfigmatch the pre-split class.
tests/unit_tests/cpu/models/common/test_multimodal.py: catches amultimodal config with no encoder being accepted. It sets Kimi K3
debugmodel_mm'svision_encoder=None, whereMultimodalModel.Configis theonly check (with the check removed, the config is accepted).
test_vllm_multimodal_wrapper.py: the Controller test now covers bothdirections.
test_shared_model_builds_without_vision_encoder(qwen3_8): it builta multimodal flavor with
vision_encoder=None, which now raises(
test_multimodal.pycovers that). No CPU unit test builds the text-onlyQwen3.5 model; the Qwen3.5 text numerics runs above and the RL debug recipes
(
rl_grpo_qwen3_5_debug_varlen) build it.Known issues / follow-ups
KimiK25Model.Config(MultimodalModel.Config, DeepSeekV3Model.Config)(onmain) loses
DeepSeekV3Model.Config'slocal_compiledefault, so Kimi K2.xflavors run with no compiled regions. Left as is (fixing it changes compiled
regions);
KimiK2Model.Configcarries a TODO.tests/unit_tests/cpu/models/qwen3_5/test_qwen3_5.pyis always skipped bypytest.importorskip("fla")(flais in no requirements file). With theguard stubbed out, the same 5 tests fail on main and on this branch
(
test_qwen35_always_calls_vision_encoder_twicex4,test_qwen35_vision_projections_are_not_dense_tp_boundaries); the rest pass.flex_attention):
test_qwen3_5_mrope_positions.py(3),test_lora_forward,test_lora_head_only_matches_cross_entropy.