Skip to content

Commit 664aa5b

Browse files
authored
Add note to Trainer.log_dir docs when used with multi-processing (#18179)
1 parent 4e30879 commit 664aa5b

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
@@ -1221,11 +1221,13 @@ def model(self) -> Optional[torch.nn.Module]:
12211221
def log_dir(self) -> Optional[str]:
12221222
"""The directory for the current experiment. Use this to save images to, etc...
12231223
1224-
.. code-block:: python
1224+
.. note:: You must call this on all processes. Failing to do so will cause your program to stall forever.
12251225
1226-
def training_step(self, batch, batch_idx):
1227-
img = ...
1228-
save_img(img, self.trainer.log_dir)
1226+
.. code-block:: python
1227+
1228+
def training_step(self, batch, batch_idx):
1229+
img = ...
1230+
save_img(img, self.trainer.log_dir)
12291231
"""
12301232
if len(self.loggers) > 0:
12311233
if not isinstance(self.loggers[0], TensorBoardLogger):

0 commit comments

Comments
 (0)