File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1045,6 +1045,14 @@ def _create_megatron_config(
10451045 "overlap_param_gather" : overlap_param_gather ,
10461046 "reuse_grad_buf_for_mxfp8_param_ag" : reuse_grad_buf_for_mxfp8_param_ag ,
10471047 }
1048+ # OptimizerConfig.__post_init__ treats fp8_recipe=None as "no fp8 params" and
1049+ # lets the precision-aware optimizer keep fp32 masters inside FusedAdam,
1050+ # leaving None placeholders in shard_fp32_from_float16_groups; with
1051+ # reuse_grad_buf_for_mxfp8_param_ag the shared param buffer must be refilled
1052+ # from those masters each step, so the recipe has to be plumbed to the
1053+ # optimizer just like Megatron pretrain's get_megatron_optimizer_config does.
1054+ if fp8_cfg is not None and fp8_cfg .get ("enabled" , False ):
1055+ optimizer_kwargs ["fp8_recipe" ] = fp8_cfg .get ("fp8_recipe" )
10481056
10491057 # Fused linear logprobs run the decoder but read output_layer.weight directly
10501058 # instead of calling output_layer.forward(). Megatron's distributed-optimizer
You can’t perform that action at this time.
0 commit comments