GAN training is currently broken. Pytorch Lightning also had the same issue described in detail: Lightning-AI/pytorch-lightning#591, Lightning-AI/pytorch-lightning#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: Lightning-AI/pytorch-lightning#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.