Skip to content

[NOT READY][Module][Qwen3-VL] Config-based dense sharding for Qwen3-VL - #3399

Closed
fegin wants to merge 9 commits into
gh/fegin/124/basefrom
gh/fegin/124/head
Closed

fegin wants to merge 9 commits into
gh/fegin/124/basefrom
gh/fegin/124/head

Conversation

@fegin

@fegin fegin commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):


  • Convert vision encoder submodules (PatchEmbed, VisionRotaryEmbedding, PatchMerger, VisionAttention, VisionMLP, VisionTransformerBlock, Qwen3VLVisionEncoder) to Module protocol with Config subclasses.
  • Add qwen3_vl/sharding.py with set_qwen3_vl_sharding_config covering decoder dense + vision encoder. MoE sharding deferred to the MoE PR.
  • Rewrite parallelize_qwen3_vl: dense path uses model.parallelize(), MoE still uses legacy apply_moe_ep_tp.
  • Wire update_from_config to call set_qwen3_vl_sharding_config.

[ghstack-poisoned]
fegin added 5 commits May 20, 2026 14:24
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
fegin added a commit that referenced this pull request May 26, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0)
(oldest at bottom):
* #3401
* #3399
* __->__ #3398

**Motivation**
`from_nn_module` is designed to be a drop-in replacement of nn.Module.
However it causes several issues including not easy to do sharding and
may violate the `build()` constraint. So instead of continuing hacking
it, this PR replaces the usage in TorchTitan with the explicit class
definitions.

**Summary**
Replace `Module.from_nn_module` dynamic class generation with explicit
diamond-inheritance classes in nn_modules.py, following the same pattern
as Linear, RMSNorm, and Embedding.

**Detail**
- Add Conv2d, GroupNorm, LayerNorm (parameterized, with typed Config
fields and _init_self_parameters override delegating to
reset_parameters)
- Add GELU, SiLU, Identity (lightweight, Config with minimal or no extra
fields)
- Delete from_nn_module classmethod and _created_classes cache from
module.py (~80 lines removed)
- Update all flux callsites (layers.py, autoencoder.py) from direct
construction to Config-based construction
- Rewrite TestFromNnModule as TestNnModuleWrappers testing native
classes
fegin added 3 commits May 26, 2026 09:38
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@fegin fegin closed this May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant