deepspeedai / deepspeedai/DeepSpeed

unnecessary gradients in case of multiple optimizers / engines

Open
#399 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

GAN training is currently broken. Pytorch Lightning also had the same issue described in detail: https://github.com/PyTorchLightning/pytorch-lightning/issues/591, https://github.com/PyTorchLightning/pytorch-lightning/issues/592

In a 2 engine setup, my expectation was that running backward() in one of the engines would only accumulate gradients in the engine on which backward() is called. However, this is not the current behaviour. The Lightning folks have recently fixed it with this PR: https://github.com/PyTorchLightning/pytorch-lightning/pull/603 where backward() will only compute gradients on that engine’s parameters (imho there should be a flag to set this behavior that defaults to True). It would be great to have this fix in DeepSpeed as well.

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

The issue names no DeepSpeed files or tests. Start by reading the referenced PyTorch Lightning issues and PR, then reproduce the two-engine GAN setup and trace DeepSpeed's backward handling. Done means backward() on one engine no longer accumulates gradients for the other engine's parameters, with coverage for the multi-engine case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.