From dfa35dac99fb088f342d76ed3302d943a40bbf40 Mon Sep 17 00:00:00 2001 From: Wouter Zwerink <35296208+wouterzwerink@users.noreply.github.com> Date: Tue, 28 Feb 2023 12:13:42 +0100 Subject: [PATCH] Require neptune 1.0 (#16888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos MocholĂ­ --- .../visualize/supported_exp_managers.rst | 2 +- requirements/pytorch/loggers.info | 2 +- src/lightning/pytorch/CHANGELOG.md | 3 +++ src/lightning/pytorch/loggers/neptune.py | 12 ++++++------ tests/tests_pytorch/test_cli.py | 4 ++-- tests/tests_pytorch/utilities/test_imports.py | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/source-pytorch/visualize/supported_exp_managers.rst b/docs/source-pytorch/visualize/supported_exp_managers.rst index 41160d17a0..53068a8860 100644 --- a/docs/source-pytorch/visualize/supported_exp_managers.rst +++ b/docs/source-pytorch/visualize/supported_exp_managers.rst @@ -68,7 +68,7 @@ To use `Neptune.ai `_ first install the neptune package: .. code-block:: bash - pip install neptune-client + pip install neptune or with conda: diff --git a/requirements/pytorch/loggers.info b/requirements/pytorch/loggers.info index d0b9c539bc..b9decca470 100644 --- a/requirements/pytorch/loggers.info +++ b/requirements/pytorch/loggers.info @@ -1,5 +1,5 @@ # all supported loggers. this list is here as a reference, but they are not installed in CI -neptune-client +neptune>=1.0.0 comet-ml mlflow>=1.0.0 wandb diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md index 6c2ff7f050..a600c7c593 100644 --- a/src/lightning/pytorch/CHANGELOG.md +++ b/src/lightning/pytorch/CHANGELOG.md @@ -142,6 +142,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Merged the `DDPSpawnStrategy` into `DDPStrategy` ([#16809](https://github.com/Lightning-AI/lightning/pull/16809)) +- The `NeptuneLogger` now requires `neptune>=1.0.0` ([#16888](https://github.com/Lightning-AI/lightning/pull/16888)) + + ### Deprecated - diff --git a/src/lightning/pytorch/loggers/neptune.py b/src/lightning/pytorch/loggers/neptune.py index 37b33e6856..87968c511b 100644 --- a/src/lightning/pytorch/loggers/neptune.py +++ b/src/lightning/pytorch/loggers/neptune.py @@ -34,10 +34,10 @@ from lightning.pytorch.loggers.logger import Logger, rank_zero_experiment from lightning.pytorch.utilities.model_summary import ModelSummary from lightning.pytorch.utilities.rank_zero import rank_zero_only -_NEPTUNE_AVAILABLE = RequirementCache("neptune-client") +_NEPTUNE_AVAILABLE = RequirementCache("neptune>=1.0.0") if _NEPTUNE_AVAILABLE: - from neptune import new as neptune - from neptune.new.run import Run + import neptune + from neptune.run import Run else: # needed for test mocks, and function signatures neptune, Run = None, None @@ -55,7 +55,7 @@ class NeptuneLogger(Logger): .. code-block:: bash - pip install neptune-client + pip install neptune or conda: @@ -86,7 +86,7 @@ class NeptuneLogger(Logger): .. code-block:: python - from neptune.new.types import File + from neptune.types import File from lightning.pytorch import LightningModule @@ -302,7 +302,7 @@ class NeptuneLogger(Logger): ) -> None: # check if user passed the client `Run` object if run is not None and not isinstance(run, Run): - raise ValueError("Run parameter expected to be of type `neptune.new.Run`.") + raise ValueError("Run parameter expected to be of type `neptune.Run`.") # check if user passed redundant neptune.init_run arguments when passed run any_neptune_init_arg_passed = any(arg is not None for arg in [api_key, project, name]) or neptune_run_kwargs if run is not None and any_neptune_init_arg_passed: diff --git a/tests/tests_pytorch/test_cli.py b/tests/tests_pytorch/test_cli.py index 695d16060d..34bbc4f4d1 100644 --- a/tests/tests_pytorch/test_cli.py +++ b/tests/tests_pytorch/test_cli.py @@ -1384,7 +1384,7 @@ def test_comet_logger_init_args(): ) -@pytest.mark.skipif(not _NEPTUNE_AVAILABLE, reason="neptune-client is required") +@pytest.mark.skipif(not _NEPTUNE_AVAILABLE, reason="neptune is required") def test_neptune_logger_init_args(): _test_logger_init_args( "NeptuneLogger", @@ -1392,7 +1392,7 @@ def test_neptune_logger_init_args(): "name": "neptune", # Resolve from NeptuneLogger.__init__ }, { - "description": "neptune", # Unsupported resolving from neptune.new.internal.init.run.init_run + "description": "neptune", # Unsupported resolving from neptune.internal.init.run.init_run }, ) diff --git a/tests/tests_pytorch/utilities/test_imports.py b/tests/tests_pytorch/utilities/test_imports.py index 69610e5702..8842a34a79 100644 --- a/tests/tests_pytorch/utilities/test_imports.py +++ b/tests/tests_pytorch/utilities/test_imports.py @@ -93,7 +93,7 @@ def clean_import(): ("torch.distributed.is_available", _shortcut_patch(is_available, ()), "lightning.pytorch"), ( "lightning_utilities.core.imports.RequirementCache.__bool__", - _shortcut_patch(RequirementCache.__bool__, ("neptune-client",), ("requirement",)), + _shortcut_patch(RequirementCache.__bool__, ("neptune",), ("requirement",)), "lightning.pytorch.loggers.neptune", ), (