Skip to content

Commit 1f4bc99

Browse files
rittik9Borda
authored andcommitted
Allow dataloader_idx_ in log names when add_dataloader_idx=False (#20987)
(cherry picked from commit 37f559e)
1 parent 0066979 commit 1f4bc99

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lightning/pytorch/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1010

1111
### Changed
1212

13-
-
13+
- Allow `dataloader_idx_` in log names when `add_dataloader_idx=False` ([#20987](https://github.com/Lightning-AI/pytorch-lightning/pull/20987))
1414

1515

1616
### Fixed

src/lightning/pytorch/core/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,10 @@ def log(
466466
)
467467

468468
# make sure user doesn't introduce logic for multi-dataloaders
469-
if "/dataloader_idx_" in name:
469+
if add_dataloader_idx and "/dataloader_idx_" in name:
470470
raise MisconfigurationException(
471471
f"You called `self.log` with the key `{name}`"
472-
" but it should not contain information about `dataloader_idx`"
472+
" but it should not contain information about `dataloader_idx` when `add_dataloader_idx=True`"
473473
)
474474

475475
value = apply_to_collection(value, (Tensor, numbers.Number), self.__to_tensor, name)

0 commit comments

Comments
 (0)