From 90c257e8d010d9a00d03626319c067d4f01f074b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Mon, 23 Aug 2021 23:54:22 +0200 Subject: [PATCH 1/6] deprecate test tube logger --- CHANGELOG.md | 5 +++-- pytorch_lightning/loggers/test_tube.py | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed5abd35c997..102c64f0a3afb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,10 +129,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Deprecated `DataModule` properties: `train_transforms`, `val_transforms`, `test_transforms`, `size`, `dims` ([#8851](https://github.com/PyTorchLightning/pytorch-lightning/pull/8851)) -- Deprecated `prepare_data_per_node` flag on Trainer and set it as a property of `DataHooks`, accessible in the `LightningModule` and `LightningDataModule` [#8958](https://github.com/PyTorchLightning/pytorch-lightning/pull/8958) +- Deprecated `prepare_data_per_node` flag on Trainer and set it as a property of `DataHooks`, accessible in the `LightningModule` and `LightningDataModule` ([#8958](https://github.com/PyTorchLightning/pytorch-lightning/pull/8958)) -- +- Deprecated the `TestTubeLogger` ([#olkajsdföljasölfdja](https://github.com/PyTorchLightning/pytorch-lightning/pull/lökajsdljfaödflj)) + ### Removed diff --git a/pytorch_lightning/loggers/test_tube.py b/pytorch_lightning/loggers/test_tube.py index 800b13b83c39c..3ce077fbaf7e6 100644 --- a/pytorch_lightning/loggers/test_tube.py +++ b/pytorch_lightning/loggers/test_tube.py @@ -36,6 +36,10 @@ class TestTubeLogger(LightningLoggerBase): Log to local file system in `TensorBoard `_ format but using a nicer folder structure (see `full docs `_). + Warning: + The test-tube package is no longer maintained and PyTorch Lightning will remove the :class:´TestTubeLogger´ + in v1.7.0. + Install it with pip: .. code-block:: bash @@ -97,6 +101,10 @@ def __init__( log_graph: bool = False, prefix: str = "", ): + rank_zero_warn( + "The TestTubeLogger is deprecated since v1.5 and will be removed in v1.7. We recommend switching to the" + " `pytorch_lightning.loggers.TensorBoardLogger` for an alternative." + ) if Experiment is None: raise ImportError( "You want to use `test_tube` logger which is not installed yet," From a699b608b3c6cd82e2c77ba4f8d380ef51693899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Mon, 23 Aug 2021 23:56:43 +0200 Subject: [PATCH 2/6] test warning --- pytorch_lightning/loggers/test_tube.py | 4 ++-- tests/deprecated_api/test_remove_1-7.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/loggers/test_tube.py b/pytorch_lightning/loggers/test_tube.py index 3ce077fbaf7e6..439e433a7dea9 100644 --- a/pytorch_lightning/loggers/test_tube.py +++ b/pytorch_lightning/loggers/test_tube.py @@ -20,7 +20,7 @@ import pytorch_lightning as pl from pytorch_lightning.loggers.base import LightningLoggerBase, rank_zero_experiment -from pytorch_lightning.utilities import _module_available, rank_zero_warn +from pytorch_lightning.utilities import _module_available, rank_zero_warn, rank_zero_deprecation from pytorch_lightning.utilities.distributed import rank_zero_only _TESTTUBE_AVAILABLE = _module_available("test_tube") @@ -101,7 +101,7 @@ def __init__( log_graph: bool = False, prefix: str = "", ): - rank_zero_warn( + rank_zero_deprecation( "The TestTubeLogger is deprecated since v1.5 and will be removed in v1.7. We recommend switching to the" " `pytorch_lightning.loggers.TensorBoardLogger` for an alternative." ) diff --git a/tests/deprecated_api/test_remove_1-7.py b/tests/deprecated_api/test_remove_1-7.py index 7581bf2b0c142..59987554ca759 100644 --- a/tests/deprecated_api/test_remove_1-7.py +++ b/tests/deprecated_api/test_remove_1-7.py @@ -16,6 +16,7 @@ import pytest from pytorch_lightning import LightningDataModule, Trainer +from pytorch_lightning.loggers import TestTubeLogger from tests.deprecated_api import _soft_unimport_module from tests.helpers import BoringModel from tests.helpers.datamodules import MNISTDataModule @@ -87,3 +88,8 @@ def test_v1_7_0_trainer_prepare_data_per_node(tmpdir): match="Setting `prepare_data_per_node` with the trainer flag is deprecated and will be removed in v1.7.0!" ): _ = Trainer(prepare_data_per_node=False) + + +def test_v1_7_0_test_tube_logger(tmpdir): + with pytest.deprecated_call(match="The TestTubeLogger is deprecated since v1.5 and will be removed in v1.7"): + _ = TestTubeLogger(tmpdir) From 551614c9bd2a2f34b0bcff8b7bfd362e3339af81 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 22:02:38 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pytorch_lightning/loggers/test_tube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/loggers/test_tube.py b/pytorch_lightning/loggers/test_tube.py index 439e433a7dea9..167d7e93c40c2 100644 --- a/pytorch_lightning/loggers/test_tube.py +++ b/pytorch_lightning/loggers/test_tube.py @@ -20,7 +20,7 @@ import pytorch_lightning as pl from pytorch_lightning.loggers.base import LightningLoggerBase, rank_zero_experiment -from pytorch_lightning.utilities import _module_available, rank_zero_warn, rank_zero_deprecation +from pytorch_lightning.utilities import _module_available, rank_zero_deprecation, rank_zero_warn from pytorch_lightning.utilities.distributed import rank_zero_only _TESTTUBE_AVAILABLE = _module_available("test_tube") From b1c5de27cdb24e499aa1542f43f1c3e925b9d2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Thu, 26 Aug 2021 01:34:32 +0200 Subject: [PATCH 4/6] Update CHANGELOG.md Co-authored-by: Kaushik B <45285388+kaushikb11@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 102c64f0a3afb..cf6a4ef5b557f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,7 +132,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Deprecated `prepare_data_per_node` flag on Trainer and set it as a property of `DataHooks`, accessible in the `LightningModule` and `LightningDataModule` ([#8958](https://github.com/PyTorchLightning/pytorch-lightning/pull/8958)) -- Deprecated the `TestTubeLogger` ([#olkajsdföljasölfdja](https://github.com/PyTorchLightning/pytorch-lightning/pull/lökajsdljfaödflj)) +- Deprecated the `TestTubeLogger` ([#9065](https://github.com/PyTorchLightning/pytorch-lightning/pull/9065)) ### Removed From de61bbb3ba0fb16315cb0652e1a7886adc7f6a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Thu, 26 Aug 2021 01:34:49 +0200 Subject: [PATCH 5/6] Update pytorch_lightning/loggers/test_tube.py Co-authored-by: Kaushik B <45285388+kaushikb11@users.noreply.github.com> --- pytorch_lightning/loggers/test_tube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/loggers/test_tube.py b/pytorch_lightning/loggers/test_tube.py index 167d7e93c40c2..dfc5d29440680 100644 --- a/pytorch_lightning/loggers/test_tube.py +++ b/pytorch_lightning/loggers/test_tube.py @@ -103,7 +103,7 @@ def __init__( ): rank_zero_deprecation( "The TestTubeLogger is deprecated since v1.5 and will be removed in v1.7. We recommend switching to the" - " `pytorch_lightning.loggers.TensorBoardLogger` for an alternative." + " `pytorch_lightning.loggers.TensorBoardLogger` as an alternative." ) if Experiment is None: raise ImportError( From f4c468e69721c044b7f23fee16abd23be9b6a576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Thu, 26 Aug 2021 10:10:42 +0200 Subject: [PATCH 6/6] mock experiment if test-tube not installed --- tests/deprecated_api/test_remove_1-7.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/deprecated_api/test_remove_1-7.py b/tests/deprecated_api/test_remove_1-7.py index 59987554ca759..ae8f9e1dcc53d 100644 --- a/tests/deprecated_api/test_remove_1-7.py +++ b/tests/deprecated_api/test_remove_1-7.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ Test deprecated functionality which will be removed in v1.7.0 """ +from unittest import mock import pytest @@ -90,6 +91,7 @@ def test_v1_7_0_trainer_prepare_data_per_node(tmpdir): _ = Trainer(prepare_data_per_node=False) -def test_v1_7_0_test_tube_logger(tmpdir): +@mock.patch("pytorch_lightning.loggers.test_tube.Experiment") +def test_v1_7_0_test_tube_logger(_, tmpdir): with pytest.deprecated_call(match="The TestTubeLogger is deprecated since v1.5 and will be removed in v1.7"): _ = TestTubeLogger(tmpdir)