verl icon indicating copy to clipboard operation
verl copied to clipboard

About context parallel in Qwen-3.5 training

Open kkkeepgoing opened this issue 7 months ago • 8 comments

请问Qwen3.5的训练什么时候可以支持上下文并行呢

kkkeepgoing avatar Apr 08 '26 07:04 kkkeepgoing

Megatron dev branch has supported BSHD/THD+CP, upgrade following deps:

pip install transformers==5.5.0 flash-linear-attention
pip install --no-deps git+https://github.com/NVIDIA/Megatron-LM.git@dev
pip install --force-reinstall git+https://github.com/ISEEKYAN/mbridge.git

wuxibin89 avatar Apr 08 '26 09:04 wuxibin89

源码更新megatron-LM版本到0.18.0rc0,mbridge版本为0.15.1,还是报不支持,请问是为啥呢 File "/usr/local/lib/python3.12/dist-packages/mbridge/core/auto_bridge.py", line 48, in from_config return _MODEL_REGISTRY[model_type](hf_config, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/mbridge/core/bridge.py", line 54, in init self.config = self._build_config() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/mbridge/models/qwen3_5/qwen3_5_vl_bridge.py", line 194, in _build_config return self._build_base_config( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/mbridge/core/llm_bridge.py", line 109, in _build_base_config return self.TransformerConfigClass(**base_config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 269, in init File "/usr/local/lib/python3.12/dist-packages/megatron/core/transformer/transformer_config.py", line 1102, in post_init assert self.context_parallel_size == 1, ( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: Gated delta net does not support context parallel for now, but got self.context_parallel_size=2.

kkkeepgoing avatar Apr 09 '26 11:04 kkkeepgoing

Any following update? Is CP usable now?

DrAlbedo avatar Apr 14 '26 03:04 DrAlbedo

Any following update? Is CP usable now?

CP is still unusable

kkkeepgoing avatar Apr 14 '26 05:04 kkkeepgoing

usable

I can use qwen35+ megatron+sglang with cp now,which megatron-core 0.18.0+a2d71539d. At the same time, you need to update mbridge, mbridge commit 1cd9ee984460e36f8ee5f35b8d20b30271bf3af5. Now i can use cp=8 with 128 H200.

tongruiliu avatar May 04 '26 06:05 tongruiliu

usable

I can use qwen35+ megatron+sglang with cp now,which megatron-core 0.18.0+a2d71539d. At the same time, you need to update mbridge, mbridge commit 1cd9ee984460e36f8ee5f35b8d20b30271bf3af5. Now i can use cp=8 with 128 H200.

@tongruiliu I use the same versions of megatron-core and mbridge as yours, but when I train Qwen3.5-35B-A3B with both cp > 1 and pp > 1, the following error occurs. It seems there is something wrong when using both cp and pp together:

 (TaskRunner pid=187523)                      ^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=187523)   File "/usr/local/lib/python3.12/site-packages/megatron/core/pipeline_parallel/schedules.py", line 2403, in forward_backward_pipelining_without_interleaving
(TaskRunner pid=187523)     output_tensor, num_tokens = forward_step(
(TaskRunner pid=187523)                                 ^^^^^^^^^^^^^
(TaskRunner pid=187523)   File "/usr/local/lib/python3.12/site-packages/megatron/core/pipeline_parallel/schedules.py", line 440, in forward_step
(TaskRunner pid=187523)     output_tensor, loss_func = forward_step_func(data_iterator, model)
(TaskRunner pid=187523)                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=187523)   File "/usr/local/lib/python3.12/site-packages/verl/workers/engine/megatron/transformer_impl.py", line 905, in forward_step
(TaskRunner pid=187523)     output = forward_fn(
(TaskRunner pid=187523)              ^^^^^^^^^^^
(TaskRunner pid=187523)   File "/usr/local/lib/python3.12/site-packages/verl/models/mcore/model_forward.py", line 394, in gptmodel_forward_model_engine
(TaskRunner pid=187523)     output = postprocess_bshd_engine(output_orig, attention_mask_bshd, post_process=post_process)
(TaskRunner pid=187523)              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=187523)   File "/usr/local/lib/python3.12/site-packages/verl/models/mcore/util.py", line 640, in postprocess_bshd_engine
(TaskRunner pid=187523)     assert output.shape[:2] == attention_mask.shape, (
(TaskRunner pid=187523)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=187523) AssertionError: output.shape: torch.Size([155, 1, 2048]), attention_mask.shape: torch.Size([1, 310])

MrYYYYYYYYYYY avatar May 07 '26 09:05 MrYYYYYYYYYYY

@MrYYYYYYYYYYY 你好 请问现在你可以用sgl + Megatron训练qwen3.5 a3b了吗?

kkyyxhll avatar Jun 11 '26 14:06 kkyyxhll

  1. Megatron dev branch has supported BSHD/THD+CP, upgrade following deps: pip install transformers==5.5.0 flash-linear-attention pip install --no-deps git+https://github.com/NVIDIA/Megatron-LM.git@dev pip install --force-reinstall git+https://github.com/ISEEKYAN/mbridge.git

Could you please share the commit id of Megatron-LM and mbridge, which are installed in this way?

zyz0000 avatar Oct 13 '26 02:10 zyz0000