[bugfix] Group defaults to WORLD if None (#5125)
* [bugfix] Group defaults to WORLD if None
* fix no_grad
* Update pytorch_lightning/utilities/distributed.py
* Update pytorch_lightning/utilities/distributed.py
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
(cherry picked from commit 176735097a
)
This commit is contained in:
parent
4349de8316
commit
0858beaf6b
|
@ -202,6 +202,7 @@ def all_gather_ddp_if_available(
|
|||
Return:
|
||||
A tensor of shape (world_size, batch, ...)
|
||||
"""
|
||||
group = group if group is not None else torch.distributed.group.WORLD
|
||||
if torch.distributed.is_available() and torch.distributed.is_initialized():
|
||||
if sync_grads:
|
||||
return AllGatherGrad.apply(tensor, group)
|
||||
|
|
Loading…
Reference in New Issue