From 17cb3c70f7893f318ed9344af8c8f9c4e5d128da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Mon, 3 Jan 2022 13:49:17 +0100 Subject: [PATCH] Fix data fetcher selection (#11294) --- CHANGELOG.md | 3 +++ pytorch_lightning/trainer/connectors/data_connector.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a419c02a50429..daa13bdea0892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -375,6 +375,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed dataloaders not getting reloaded the correct amount of times when setting `reload_dataloaders_every_n_epochs` and `check_val_every_n_epoch` ([#10948](https://github.com/PyTorchLightning/pytorch-lightning/pull/10948)) +- Fixed data fetcher selection ([#11294](https://github.com/PyTorchLightning/pytorch-lightning/pull/11294)) + + ## [1.5.7] - 2021-12-21 ### Fixed diff --git a/pytorch_lightning/trainer/connectors/data_connector.py b/pytorch_lightning/trainer/connectors/data_connector.py index c83b5b6483db3..eae699081f141 100644 --- a/pytorch_lightning/trainer/connectors/data_connector.py +++ b/pytorch_lightning/trainer/connectors/data_connector.py @@ -114,7 +114,7 @@ def _select_data_fetcher(self) -> AbstractDataFetcher: def get_profiled_dataloader(self, dataloader: Iterable, dataloader_idx: int = 0) -> Iterable: stage: str = self.trainer.state.stage.value - data_fetcher = setattr(self, f"{stage}_data_fetcher", None) or self._select_data_fetcher() + data_fetcher = getattr(self, f"{stage}_data_fetcher", None) or self._select_data_fetcher() data_fetcher.setup( dataloader, stage=stage,