fix(checkpointer): use dp_reshardable sharding type for megatron-core >=0.11#1344
Open
theNefelibata wants to merge 3 commits into
Open
fix(checkpointer): use dp_reshardable sharding type for megatron-core >=0.11#1344theNefelibata wants to merge 3 commits into
theNefelibata wants to merge 3 commits into
Conversation
… >=0.11 megatron-core >=0.11 removed flattened_range support in ShardedTensor.validate_metadata_integrity(), but the default sharding type (fully_sharded_model_space) still sets flattened_range, causing save/load to fail. Switch to dp_reshardable which does not rely on flattened_range. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the hard-coded 'dp_reshardable' sharding type into MegatronEngineConfig so users with legacy checkpoints saved under 'fully_sharded_model_space' can load them by flipping the config instead of patching the source. Key changes: - Add distrib_optim_sharding_type field to MegatronEngineConfig (default 'dp_reshardable') - Plumb the value through MegatronCheckpointManager and use it in generate_state_dict instead of the hard-coded string
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.
Summary
flattened_rangesupport inShardedTensor.validate_metadata_integrity(), but the default sharding type (fully_sharded_model_space) still setsflattened_range, causing checkpoint save/load to faildp_reshardablesharding type which does not rely onflattened_rangeCloses #1343
Test plan