File tree Expand file tree Collapse file tree
src/megatron/bridge/recipes/qwen_vl/h100
tests/unit_tests/recipes/qwen_vl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -951,7 +951,9 @@ def qwen35_vl_35b_a3b_sft_2gpu_h100_bf16_fsdp_config() -> ConfigContainer:
951951 cfg .model .attention_backend = "auto"
952952 cfg .model .gradient_accumulation_fusion = True
953953 cfg .model .cross_entropy_loss_fusion = True
954- cfg .model .cross_entropy_fusion_impl = "native"
954+ # Native fused cross entropy materializes a full FP32 vocabulary-sized
955+ # softmax buffer. Use the TE kernel to keep the 248K-token loss bounded.
956+ cfg .model .cross_entropy_fusion_impl = "te"
955957
956958 # MoE settings
957959 cfg .model .moe_token_dispatcher_type = "alltoall"
@@ -965,10 +967,12 @@ def qwen35_vl_35b_a3b_sft_2gpu_h100_bf16_fsdp_config() -> ConfigContainer:
965967 cfg .model .moe_router_padding_for_fp8 = False
966968
967969 # Memory saving
968- cfg .model .recompute_granularity = None
970+ # Full SFT retains FP32 optimizer state alongside the FSDP communication
971+ # pools, so recompute each transformer layer to bound live activations.
972+ cfg .model .recompute_granularity = "full"
969973 cfg .model .recompute_modules = None
970- cfg .model .recompute_method = None
971- cfg .model .recompute_num_layers = None
974+ cfg .model .recompute_method = "uniform"
975+ cfg .model .recompute_num_layers = 1
972976 cfg .model .fine_grained_activation_offloading = False
973977 cfg .model .offload_modules = None
974978
Original file line number Diff line number Diff line change @@ -431,6 +431,12 @@ def test_qwen35_vl_35b_a3b_fsdp_sft_defaults(monkeypatch: pytest.MonkeyPatch):
431431 assert cfg .model .sequence_parallel is False
432432 assert cfg .model .moe_token_dispatcher_type == "alltoall"
433433 assert cfg .model .moe_router_fusion is True
434+ assert cfg .model .cross_entropy_loss_fusion is True
435+ assert cfg .model .cross_entropy_fusion_impl == "te"
436+ assert cfg .model .recompute_granularity == "full"
437+ assert cfg .model .recompute_modules is None
438+ assert cfg .model .recompute_method == "uniform"
439+ assert cfg .model .recompute_num_layers == 1
434440 assert cfg .ddp .use_megatron_fsdp is True
435441 assert cfg .ddp .fsdp_double_buffer is True
436442 assert cfg .ddp .megatron_fsdp_max_pool_double_buffer is True
You can’t perform that action at this time.
0 commit comments