deepspeedai / deepspeedai/DeepSpeed

[REQUEST] split zero3 checkpoint files into optim states and master weights

Open
#4,029 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Currently, if one wants to pull out fp32 weights from the zero-3 checkpoint they have to load the full checkpoints that contain 3x of data that the user needs. And for huge models this can take hours.

I have already created a PR to drop the optim states here https://github.com/microsoft/DeepSpeed/pull/4025 since otherwise the user needs 3x cpu memory, but the fix can only discard that unneeded data after loading it, so it's still very slow.

One of the solutions I proposed is to split each of the fp32+state1+state2 shard files into 2 files:

  1. fp32
  2. state1+state2

that way a user not caring about optim states and just wants to retrieve weights will be able to perform the extraction much much faster.

as I mentioned in the PR, the other option is to switch to https://github.com/huggingface/safetensors/ which allows selective loading of tensors, rather than all-in-one loading.

@tjruwase

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review PR #4025 first, then locate the Zero-3 checkpoint shard-writing and fp32 extraction entry points; the issue names no files or tests. Compare the proposed split-file approach with selective loading via safetensors. Done means weight-only extraction can avoid loading optimizer states and no longer requires reading the unnecessary checkpoint data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.