Repository navigation
[model] fix: Finalize providers before distributed model construction - #5613
Merged
Merged
Conversation
Signed-off-by: Yu Yao <yaoyu.094@gmail.com>
Contributor
Author
|
/ok to test 626eb60 |
Contributor
|
LGTM — the fix is well-scoped and correctly tested. Summary: Adding self.finalize() before get_model(...) in provide_distributed_model ensures deferred heterogeneous fields (e.g. per_block_parameters) are computed before the model is built. This closes a gap where a provider constructed and passed directly to provide_distributed_model (bypassing apply_overrides_and_finalize) would build with un-parsed config. Verified, no concerns:
Suggested test cases:
|
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Contributor
Author
|
/ok to test 26d2fb1 |
@yaoyu-33, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
Contributor
Author
|
/ok to test 26d2fb1 |
This branch was previously deployed
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.
What changed
Finalize legacy model providers in the training setup caller immediately before entering
provide_distributed_model(), and add a focused regression test for heterogeneous Llama-Nemotron providers.Bug and impact
Heterogeneous providers defer Megatron-Core post-initialization, so derived fields such as
per_block_parametersdo not exist untilfinalize()runs. The training construction path previously enteredprovide_distributed_model()before establishing that lifecycle boundary, causing anAttributeErrorwhen model construction consumed the field._build_distributed_model()now finalizes a legacy provider after distributed initialization and immediately before invokingprovide_distributed_model(). Finalization remains an explicit caller responsibility rather than an implicit side effect of the provider method.Validation
The regression test replaces the distributed construction method with an entry callback and verifies that the heterogeneous block configuration has already been parsed before that callback is entered.
Scope
This does not change conversion mappings, provider configuration fields, public model-builder APIs, or Megatron-Core. It only makes the training setup lifecycle ordering explicit for deprecated
ModelProviderMixinproviders.