Skip to content

Commit 9af6ee4

Browse files
awaelchliBorda
authored andcommitted
Add note to Trainer.log_dir docs when used with multi-processing (#18179)
(cherry picked from commit 664aa5b)
1 parent 0111e76 commit 9af6ee4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lightning/pytorch/trainer/trainer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,11 +1167,13 @@ def model(self) -> Optional[torch.nn.Module]:
11671167
def log_dir(self) -> Optional[str]:
11681168
"""The directory for the current experiment. Use this to save images to, etc...
11691169
1170-
.. code-block:: python
1170+
.. note:: You must call this on all processes. Failing to do so will cause your program to stall forever.
11711171
1172-
def training_step(self, batch, batch_idx):
1173-
img = ...
1174-
save_img(img, self.trainer.log_dir)
1172+
.. code-block:: python
1173+
1174+
def training_step(self, batch, batch_idx):
1175+
img = ...
1176+
save_img(img, self.trainer.log_dir)
11751177
"""
11761178
if len(self.loggers) > 0:
11771179
if not isinstance(self.loggers[0], TensorBoardLogger):

0 commit comments

Comments
 (0)