Skip to content

Commit 67a3b57

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 81b3d24 commit 67a3b57

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lightning/pytorch/loops/training_epoch_loop.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,10 @@ def advance(self, data_fetcher: _DataFetcher) -> None:
275275
self.val_loop.restarting = False
276276

277277
# =====================================================================
278-
from lightning.pytorch.utilities.exceptions import SIGTERMException
279278
import contextlib
280-
279+
280+
from lightning.pytorch.utilities.exceptions import SIGTERMException
281+
281282
if dist.is_available() and dist.is_initialized() and self.trainer.world_size > 1:
282283
try:
283284
sigterm_tensor = torch.tensor(
@@ -287,7 +288,7 @@ def advance(self, data_fetcher: _DataFetcher) -> None:
287288
dist.broadcast(sigterm_tensor, src=0)
288289
except Exception:
289290
sigterm_tensor = torch.tensor([0], device=self.trainer.strategy.root_device)
290-
291+
291292
if sigterm_tensor.item() == 1:
292293
with contextlib.suppress(Exception):
293294
dist.barrier() # prevent deadlocks by syncing all ranks before exit

0 commit comments

Comments
 (0)