Repository navigation
[megatron] fix: engine alignment - #4097
Merged
Merged
Conversation
ISEEKYAN
requested review from
ZihengJiang,
eric-haibin-lin and
vermouth1992
as code owners
November 12, 2025 04:31
Contributor
There was a problem hiding this comment.
Code Review
This pull request aims to fix a discrepancy between Megatron and FSDP for bf16 training by setting finalize_model_grads_func on the model configuration. The change is implemented within the _build_optimizer method, ensuring it only applies during training, which is correct as this function is related to gradient handling. The implementation is straightforward and seems to correctly address the issue described in the pull request. I did not find any issues of high or critical severity.
Collaborator
|
Could you please add some comments in the code to inform the people why we should add this? |
vermouth1992
approved these changes
Nov 12, 2025
ISEEKYAN
commented
Nov 12, 2025
| from megatron.core.distributed import finalize_model_grads | ||
| from megatron.core.utils import get_model_config | ||
|
|
||
| # register some callbacks for megatron training, following https://github.com/NVIDIA/Megatron-LM/blob/core_v0.15.0rc7/megatron/training/training.py#L2039-L2057 |
chenjiaoAngel
added a commit
to chenjiaoAngel/verl
that referenced
this pull request
Nov 14, 2025
separate the bf16 part of verl-project#4086. to fix the gap between megatron and fsdp in bf16.
chenhaiq
pushed a commit
to The-Hierophant/verl-1
that referenced
this pull request
Nov 18, 2025
separate the bf16 part of verl-project#4086. to fix the gap between megatron and fsdp in bf16.
wuwendyy
pushed a commit
to wuwendyy/verl
that referenced
this pull request
Nov 19, 2025
separate the bf16 part of verl-project#4086. to fix the gap between megatron and fsdp in bf16.
albertimff
pushed a commit
to albertimff/verl
that referenced
this pull request
Dec 1, 2025
separate the bf16 part of verl-project#4086. to fix the gap between megatron and fsdp in bf16.
TimurTaepov
pushed a commit
to giorgossideris/verl
that referenced
this pull request
Dec 20, 2025
separate the bf16 part of verl-project#4086. to fix the gap between megatron and fsdp in bf16.
vyomakesh0728
added a commit
to vyomakesh0728/verl
that referenced
this pull request
Jan 22, 2026
separate the bf16 part of verl-project#4086. to fix the gap between megatron and fsdp in bf16.
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.
separate the bf16 part of #4086. to fix the gap between megatron and fsdp in bf16.