deepspeedai / deepspeedai/DeepSpeed
gradient_accumulation_steps integration
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
gradient_accumulation_stepsconfiguration is not documented at all - it's only mentioned in the context of pipeline- there are no instructions on how to integrate it with the existing trainer - so if our trainer already handles the accumulation most likely we should reset
gradient_accumulation_stepsto 1 in deepspeed configuration, correct? I am asking since I don't know if perhaps something else is going on and DeepSpeed needs to know about it too - asking since I see it being used indeepspeed/runtime/zero/stage2.py.
To exemplify this is what we have in place right now:
if (step + 1) % self.args.gradient_accumulation_steps == 0 ...:
# Optimizer step
if self.deepspeed:
self.deepspeed.step()
[...]
I'm pretty sure I still need to pass gradient_accumulation_steps=N to DeepSpeed, but just asking if there is something special that we should or shouldn't do in the custom trainer.
Thank you.
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 deepspeed/runtime/zero/stage2.py and the existing pipeline documentation to trace how gradient_accumulation_steps is consumed. Confirm the interaction with a custom trainer that already performs accumulation, then document the required DeepSpeed configuration, integration steps, and expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, machine-learning
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100