From 0ba25d3cac6375a6c05133022db452427032404d Mon Sep 17 00:00:00 2001 From: ananthsub Date: Mon, 7 Feb 2022 04:28:37 -0800 Subject: [PATCH] Update DDPStrategy to use optimizers property from within class (#11777) --- pytorch_lightning/strategies/ddp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/strategies/ddp.py b/pytorch_lightning/strategies/ddp.py index 7b7e4e83a2..d92b12627e 100644 --- a/pytorch_lightning/strategies/ddp.py +++ b/pytorch_lightning/strategies/ddp.py @@ -304,7 +304,7 @@ class DDPStrategy(ParallelStrategy): def _reinit_optimizers_with_post_localSGD(self, warmup_steps: int): log.detail(f"{self.__class__.__name__}: reinitializing optimizers with post localSGD") - optimizers = self.lightning_module.trainer.optimizers + optimizers = self.optimizers if self._model_averaging_period is None: raise ValueError( "Post-localSGD algorithm is used, but model averaging period is not provided to DDP strategy."