From 3d3400cd21fdee24126e2497818a4306c69c9d6a Mon Sep 17 00:00:00 2001 From: chizuchizu <44621609+Chizuchizu@users.noreply.github.com> Date: Mon, 8 Mar 2021 11:11:07 +0900 Subject: [PATCH] Fix AttributeError: 'NoneType' object has no attribute 'finalize' on TPU (#6221) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix bug Fix AttributeError: 'NoneType' object has no attribute 'finalize' * Update CHANGELOG.md * deleted a period * Update CHANGELOG.md Co-authored-by: Akihiro Nitta * Update CHANGELOG.md * Update pytorch_lightning/plugins/training_type/tpu_spawn.py Co-authored-by: Rohit Gupta Co-authored-by: Akihiro Nitta Co-authored-by: Carlos MocholĂ­ Co-authored-by: Rohit Gupta --- CHANGELOG.md | 6 ++++++ pytorch_lightning/plugins/training_type/tpu_spawn.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44fc01676f9638..064408cab8762f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed `ModelPruning(make_pruning_permanent=True)` pruning buffers getting removed when saved during training ([#6073](https://github.com/PyTorchLightning/pytorch-lightning/pull/6073)) +- Fixed when `_stable_1d_sort` to work when `n >= N` ([#6177](https://github.com/PyTorchLightning/pytorch-lightning/pull/6177)) + + +- Fixed `AttributeError` when `logger=None` on TPU ([#6221](https://github.com/PyTorchLightning/pytorch-lightning/pull/6221)) + + ## [1.2.2] - 2021-03-02 diff --git a/pytorch_lightning/plugins/training_type/tpu_spawn.py b/pytorch_lightning/plugins/training_type/tpu_spawn.py index 692a4426a6ad63..d4b8974617ac12 100644 --- a/pytorch_lightning/plugins/training_type/tpu_spawn.py +++ b/pytorch_lightning/plugins/training_type/tpu_spawn.py @@ -234,7 +234,7 @@ def __load_weights_on_main_process(self) -> None: self._model = model def _close_logger(self, trainer) -> None: - if hasattr(trainer, "logger"): + if trainer.logger is not None: trainer.logger.finalize("success") @property