Repository navigation
Conversation
ckpt_layer_path_list() sorted shard paths as plain strings. rank_repr zero-pads ranks to two digits, so with 100+ model-parallel ranks the order became model_10, model_100, model_11, ... and SDLoader handed rank 11 the shard written by rank 100. Sort by the numeric rank instead. Fixes deepspeedai#1381 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: adarshsm <24850536+adarshsm@users.noreply.github.com>
This branch has not been 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.
Fixes #1381
Problem
PipelineModule.ckpt_layer_path_list()returns the layer's checkpoint shards withckpt_files.sort(), a plain string sort. The shard names embedrank_repr, which zero-pads each rank to two digits (model_00…model_99). Once a layer is sharded across 100 or more model-parallel ranks, the string order ismodel_10, model_100, model_101, model_11, ….load_state_dir()passes that list toSDLoaderFactory.get_sd_loader(), and the loader gives shardito model-parallel ranki. So rank 11 loads the weights saved by rank 100, silently.Fix
Sort the shard paths with a natural (numeric-aware) key, reusing the same
re.split(r'(\d+)', …)idea asnatural_keysinzero_to_fp32.py/ds_to_universal.py. Those helpers live in standalone scripts, so I kept the key inline instead of importing from them.Test
TestPipeModuleCheckpointShardOrdercreates shard files for ranks0, 1, 9, 10, 11, 99, 100, 101and assertsckpt_layer_path_list()returns them in numeric order. Without the fix it fails (themodel_100/model_101shards land beforemodel_11); with it, it passes.Run on CPU only (macOS,
DS_ACCELERATOR=cpu, gloo, world_size 1). The change is a pure file-ordering fix and needs no GPU.yapfis clean on both changed files.An earlier PR for this issue (#8452) was closed by its author without being merged, so there is no open PR for it.
🤖 Generated with Claude Code