Skip to content

Commit

Permalink
Add note to Trainer.log_dir docs when used with multi-processing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Jul 27, 2023
1 parent 4e30879 commit 664aa5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lightning/pytorch/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,11 +1221,13 @@ def model(self) -> Optional[torch.nn.Module]:
def log_dir(self) -> Optional[str]:
"""The directory for the current experiment. Use this to save images to, etc...
.. code-block:: python
.. note:: You must call this on all processes. Failing to do so will cause your program to stall forever.
def training_step(self, batch, batch_idx):
img = ...
save_img(img, self.trainer.log_dir)
.. code-block:: python
def training_step(self, batch, batch_idx):
img = ...
save_img(img, self.trainer.log_dir)
"""
if len(self.loggers) > 0:
if not isinstance(self.loggers[0], TensorBoardLogger):
Expand Down

0 comments on commit 664aa5b

Please sign in to comment.