DeepSpeed
d7ab2108 - Add multi-node parallel ZeRO-3 to universal checkpoint converter

Commit
13 hours ago
Add multi-node parallel ZeRO-3 to universal checkpoint converter ds_to_universal.py converts ZeRO-3 checkpoints by dumping every dp shard into per-(param, state, dp rank) fragment files under tmp/ and then reading them all back to merge. Every byte is written and read twice, the filesystem gets params x dp x 3 small files, and parallelism is limited to one node's process pool. In ZeRO-3 the location of every param slice in every dp shard follows from (param_shapes, dp_degree) alone, so the transpose needs no intermediate files and no communication: * every rank builds the same layout and takes a numel-balanced share of (param, state) work items, * it mmaps the dp optimizer shards and copies just its slices into the final tensor, writing zero/<param>/<state>.pt directly (atomic rename, so --resume can skip finished files), * rank 0 writes optimizer_state.pt and, after a barrier, latest_universal. Ranks come from MPI (mpi4py) when launched with mpirun; otherwise it runs as a single process. optimizer_state.pt keeps only what the ZeRO-3 universal loader reads (step, param_groups, loss scaler) instead of a copy of dp rank 0's shard. Tested with DeepSpeed 0.18.4 on a Llama-3-70B-shaped model (70.6B params, dp=32, 789 GiB): * 4 nodes x 32 ranks convert in 104 s (7.6 GiB/s) on Lustre, * all 2169 output tensors match DeepSpeed's safe_get_full_* state by sha256, * the result loads at dp=24 with fp32/exp_avg/exp_avg_sq bit-exact. Small model (several sub-groups, numel not divisible by dp), saved with DeepSpeed 0.20.2 and converted with 0.20.2 and with master: bit-exact against the trained state after reloading with 0.20.2 at dp=3, 5 and 8. Not supported yet: AutoTP (mp_rank > 0) and AutoEP checkpoints, which the script rejects with an error. Signed-off-by: Xinyu Lian <lian7@illinois.edu>
Author
Committer
Parents
Loading