deepspeedai / deepspeedai/DeepSpeed
How to manipulate model weights within a ZeRO 3 training process?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
What I want to do is pretty straightforward - average the current model weights after a specified training steps with previous saved checkpoints (or torch model, whichever it works better with deepspeed). One problem I've found so far is directly accessing the model state_dict can lead to tensors of size 0, which is also mentioned in deepspeed official doc caused by model sharding.
I wonder how can I achieve this in an elegant way? I was told that even if I managed to gather all the tensors and do the average operation, I also need to cope with the fp32 model parameters maintained in the optimizer in additional to replacing the model parameters in fp16?
Any insights on this issue would be greatly appreciated. One important note is that I do need to realize this in the ZeRO 3 setting.
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
Start with the ZeRO 3 documentation on model sharding and the behavior of model state_dict tensors. Trace how saved checkpoints, gathered parameters, and the optimizer's fp32 parameters are handled during training. Done means identifying and documenting an elegant supported way to average weights at specified steps while keeping model and optimizer parameters consistent.
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
- Needs clarification
- Newbie friendliness
- 20/100