[main] [5/5] Qwen3.5 support: Qwen3.5-VL training example#4756
Open
wplf wants to merge 2 commits into
Open
Conversation
This was referenced May 12, 2026
92a00c5 to
411d25f
Compare
Adds a standalone VLM training playground under ``examples/multimodal_dev/`` with Qwen3.5-VL end-to-end. Highlights - Model-agnostic entry point (``pretrain_multimodal.py``) with a ``MODEL_REGISTRY`` so adding a new architecture is just a registry entry plus a backing module. - Qwen3.5-VL model: vision encoder, MRoPE, decoder, factory, specs, configurations covering proxy / 9B / 397B-A17B variants. - Datasets: mock data and CORD-V2 VLM dataset, with THD pack/pad in the collate function. - THD + CP support consolidated in ``forward_step.py`` and the model layer (uses MRoPE THD pre-computation and ``cu_seqlens_q_padded`` CP partitioning). - Run script + README, plus tests for MRoPE parity, CP correctness, CP support, and THD correctness / e2e. Also gates the torch DataLoader vanilla-collate path on the new ``use_vanilla_collate_fn`` arg (one-line change to ``megatron/training/datasets/data_samplers.py``) so CORD-V2 works under BSHD. Functional dependency: the new model arch sets ``mrope_interleaved=True`` in its config and relies on the core MRoPE interleaved layout introduced in a separate PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-Authored-By: BestJuly <19769279+BestJuly@users.noreply.github.com>
411d25f to
10b0b62
Compare
…shadow PR Adopt the merged dev [5/5] shadow PR NVIDIA#4751 (commit 58f3e67) verbatim for examples/multimodal_dev/ — it carries newer bug fixes: - replace data/vlm_dataset.py with data/cord_v2.py - add tests/_helpers.py, tests/test_cp_thd_correctness.py, tests/test_vision_patch_merger_parity.py - sync the remaining 23 example files to NVIDIA#4751's content data_samplers.py is intentionally NOT changed to match NVIDIA#4751: main uses args.hybrid_context_parallel whereas dev uses args.dynamic_context_parallel (the arg was renamed across branches), so NVIDIA#4756's existing line is the correct main adaptation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
|
/ok to test 52a151c |
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.
Qwen3.5 support series
This is part of a 5-PR series adding Qwen3.5-VL support, split for review clarity.
Main PRs (this series):
Dev PRs (corresponding mirrors):
Summary
Adds a standalone VLM training playground under
examples/multimodal_dev/with Qwen3.5-VL end-to-end.Model-agnostic harness
pretrain_multimodal.pyentry point andMODEL_REGISTRYso a new architecture is just a registry entry + backing module.models/base.py,forward_step.py,arguments.py,data/(mock + CORD-V2 dataset with THD pack/pad in collate).Qwen3.5-VL
models/qwen35_vl/— vision encoder, MRoPE (pre-computed for THD), decoder, factory, specs, configurations for proxy / 9B / 397B-A17B variants.tests/test_mrope_parity.py,test_cp_correctness.py,test_cp_support.py,test_thd_correctness.py,test_thd_e2e.py.One-line training infra change
megatron/training/datasets/data_samplers.py: enable the vanilla-collate torch DataLoader path when the new arguse_vanilla_collate_fnis set (needed for CORD-V2 under BSHD). Onmainthis gates onhybrid_context_parallel(which is the analogue ofdev'sdynamic_context_parallel).Dependency
This example sets
mrope_interleaved=Truein itsTransformerConfigand relies on the core MRoPE interleaved layout introduced in #4755. The diff here is self-contained, but the example won't run end-to-end until #4755 merges.Risk
examples/multimodal_dev/.data_samplers.pychange is fully backwards-compatible: behavior is unchanged unlessuse_vanilla_collate_fnis explicitly set.Notes
Mirror of #4751 (same content, targeting
maininstead ofdev). The only delta vs. the dev version is thedata_samplers.pycollate guard, which usesargs.hybrid_context_parallelhere (main) instead ofargs.dynamic_context_parallel(dev).🤖 Generated with Claude Code