deepspeedai / deepspeedai/DeepSpeed
[REQUEST] split zero3 checkpoint files into optim states and master weights
Nobody has claimed this yet.
- 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:
- fp32
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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