-
Notifications
You must be signed in to change notification settings - Fork 117
M4: Model providers update to use pg_collection #1326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yaoyu-33
wants to merge
44
commits into
main
Choose a base branch
from
m4/3_model_provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
# Conflicts: # src/megatron/bridge/training/eval.py # src/megatron/bridge/training/gpt_step.py
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
# Conflicts: # src/megatron/bridge/training/tensor_inspect.py # src/megatron/bridge/training/train.py # tests/unit_tests/models/test_gpt_full_te_layer_autocast_spec.py
Contributor
Author
|
/ok to test 71f43cb |
Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 522acef |
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.
This PR removes implicit reliance on global parallel state within the Bridge training stack by introducing an explicit
ProcessGroupCollectionflow from model construction through training steps. Model providers, steps, and utilities now derive and threadpg_collectiondirectly, improving correctness, testability, and future extensibility (e.g., multiple model instances or heterogeneous groups).Key Changes
get_pg_collection(model)utility to retrieve theProcessGroupCollectionfrom wrapped models.src/megatron/bridge/training/utils/pg_utils.pypg_collection:ModelProviderMixin.provide_distributed_model(...)initializes model-parallel (if needed), retrievespg_collectionviaProcessGroupCollection.use_mpu_process_groups(), composes hooks, and passespg_collectioninto model creation.get_model(...)now requires keyword-onlypg_collection: ProcessGroupCollectionand uses it for pipeline/tensor parallel stage decisions, mixed precision wrapping, DDP/FSDP wrapping, and rank-scoped logging.src/megatron/bridge/models/model_provider.pypg_collectionfrom the model instead of using globalparallel_state:src/megatron/bridge/training/gpt_step.pysrc/megatron/bridge/training/vlm_step.py(also adds robust padding/truncation for PP/no-PP shapes and includesvisual_inputshandling)pg_collectionexplicitly:train.train(..., pg_collection=...)andtrain_step(..., pg_collection=...)pg_collectionfor reductions, DP/MP checks, PP stage gating, and CUDA graph helperssrc/megatron/bridge/training/train.pypg_collectiondesign:pg_collection.pp/pg_collection.cpsrc/megatron/bridge/training/utils/batch_utils.pysrc/megatron/bridge/models/*_provider.pyRationale
parallel_statepg_collection)Breaking/Behavior Changes
get_model(...)now requirespg_collection(keyword-only). Typical users callingModelProviderMixin.provide_distributed_model(...)are unaffected, as the provider constructs and supplies it.train.train(...)andtrain_step(...)now take apg_collectionargument. Callers that invoked these directly must pass the collection (obtainable viaget_pg_collection(model)).pg_collectionrather than global state.