Require an explicit process-group collection in LanguageModule - #6303
Draft
Connor-XY wants to merge 1 commit into
Draft
Require an explicit process-group collection in LanguageModule#6303Connor-XY wants to merge 1 commit into
Connor-XY wants to merge 1 commit into
Conversation
LanguageModule fell back to the global parallel grid when no collection was passed, so GPTModel/BertModel/T5Model/HybridModel/MambaModel silently inherited it. For a model on independent grids that is the wrong grid, and nothing raises. The fallback becomes an assertion naming the missing argument. All 126 in-repo constructors across the family now pass a collection: 119 in tests, 6 in examples, 1 in megatron/elastification. Downstream impact is small: Megatron-Bridge already threads pg_collection through its real model-construction paths (gpt_builder, gpt_provider); an AST scan finds only 2 of its 9 GPTModel-family constructions without one, and nemo-rl-internal has none. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Contributor
Author
|
Part of #6307 — tracking issue for the |
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 does this PR do?
Makes an explicit
pg_collectionrequired for the model family rooted atLanguageModule—GPTModel,BertModel,T5Model,HybridModel,MambaModel.Today:
Pass nothing and you silently get the global parallel grid. For a model built on independent grids — a vision encoder and an LLM with different parallelism, GTP, MIMO — that is the wrong grid, and nothing raises. This is the same mechanism behind three gradient-counting bugs: #5916 (merged), #6080, #6099.
After:
Breaking change
This breaks external code that constructs these models without a collection. That is the intent — a silent wrong-grid default is worse than a loud failure.
Downstream impact is small. An AST scan of Megatron-Bridge finds 2 of its 9 GPTModel-family constructions without a collection (
examples/megatron_mimo/llava/verify_llama_conversion.py,training/mlm_compat/model.py); its real model-construction paths —gpt_builder.py,gpt_provider.py— already threadpg_collection.nemo-rl-internalhas none.All 126 in-repo constructions are updated here: 119 tests, 6 examples, 1 in
megatron/elastification.Also fixed
T5Modelacceptedpg_collectionand then dropped it:So a caller that did pass one still got the global grid. This was a live bug, not just a migration artefact.
Verification
Paired run against unmodified
mainat the same commit, same container, 8×GPU:mainIdentical, same single pre-existing failure; none of the added assertions fire. Suites:
test_gpt_model.py,test_bert_model.py,test_hybrid_model.py,test_t5_model.py.Contribution process
Pre-checks