From 9eb1907151244eb5bf84a93bc4cf2c5553b169f5 Mon Sep 17 00:00:00 2001 From: Aljoscha Steffens <52288710+Aljo-Rovco@users.noreply.github.com> Date: Fri, 21 Feb 2020 18:30:27 +0000 Subject: [PATCH] separate requirements for logger dependencies (#792) * added file that contains information on the minimal versions needed for the supported loggers * copied minimal version, combined files, deleted duplicates * sorted functions in tests/test_loggers.py to be consistent * expanded wandb logging test; added minimal versions for requirements-extra.txt; increased the amount of training data that is used for tests * formatting * added requirements-extra.txt to MANIFEST.in * reverted wandb test; ensured minimal version for dependencies in requirements-extra.txt in ci-testing.yml --- .github/workflows/ci-testing.yml | 1 + MANIFEST.in | 1 + requirements-extra.txt | 5 +++++ tests/requirements.txt | 7 +------ tests/test_logging.py | 30 +++++++++++++++--------------- 5 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 requirements-extra.txt diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 4e6c268532..6543b91a23 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -25,6 +25,7 @@ jobs: if: matrix.requires == 'minimal' run: | python -c "req = open('requirements.txt').read().replace('>', '=') ; open('requirements.txt', 'w').write(req)" + python -c "req = open('requirements-extra.txt').read().replace('>', '=') ; open('requirements-extra.txt', 'w').write(req)" - name: Cache pip uses: actions/cache@v1 diff --git a/MANIFEST.in b/MANIFEST.in index a255112ed7..3107daa69b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -29,6 +29,7 @@ recursive-include docs/source/_static/images/ lightning_logo* pl_overview* tf_* # Include the Requirements include requirements.txt +include requirements-extra.txt # Exclude build configs exclude *.yml diff --git a/requirements-extra.txt b/requirements-extra.txt new file mode 100644 index 0000000000..dd15309105 --- /dev/null +++ b/requirements-extra.txt @@ -0,0 +1,5 @@ +neptune-client>=0.4.4 +comet-ml>=1.0.56 +mlflow>=1.0.0 +test_tube>=0.7.5 +wandb>=0.8.21 \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt index 9b35ff7b6a..8267651041 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -7,11 +7,6 @@ pytest-cov pytest-flake8 flake8 check-manifest -test-tube>=0.7.5 -mlflow -comet_ml -wandb -sacred -neptune-client twine==1.13.0 pillow<7.0.0 +-r ../requirements-extra.txt \ No newline at end of file diff --git a/tests/test_logging.py b/tests/test_logging.py index 0d4104ef7a..93f0b46f2b 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -29,7 +29,7 @@ def test_testtube_logger(tmpdir): trainer_options = dict( default_save_path=tmpdir, max_epochs=1, - train_percent_check=0.01, + train_percent_check=0.05, logger=logger ) @@ -53,7 +53,7 @@ def test_testtube_pickle(tmpdir): trainer_options = dict( default_save_path=tmpdir, max_epochs=1, - train_percent_check=0.01, + train_percent_check=0.05, logger=logger ) @@ -76,7 +76,7 @@ def test_mlflow_logger(tmpdir): trainer_options = dict( default_save_path=tmpdir, max_epochs=1, - train_percent_check=0.01, + train_percent_check=0.05, logger=logger ) trainer = Trainer(**trainer_options) @@ -132,7 +132,7 @@ def test_comet_logger(tmpdir, monkeypatch): trainer_options = dict( default_save_path=tmpdir, max_epochs=1, - train_percent_check=0.01, + train_percent_check=0.05, logger=logger ) @@ -182,7 +182,16 @@ def test_wandb_logger(tmpdir): tutils.reset_seed() wandb_dir = os.path.join(tmpdir, "wandb") - _ = WandbLogger(save_dir=wandb_dir, anonymous=True) + _ = WandbLogger(save_dir=wandb_dir, anonymous=True, offline=True) + + +def test_wandb_pickle(tmpdir): + """Verify that pickling trainer with wandb logger works.""" + tutils.reset_seed() + + wandb_dir = str(tmpdir) + logger = WandbLogger(save_dir=wandb_dir, anonymous=True, offline=True) + assert logger is not None def test_neptune_logger(tmpdir): @@ -196,7 +205,7 @@ def test_neptune_logger(tmpdir): trainer_options = dict( default_save_path=tmpdir, max_epochs=1, - train_percent_check=0.01, + train_percent_check=0.05, logger=logger ) trainer = Trainer(**trainer_options) @@ -206,15 +215,6 @@ def test_neptune_logger(tmpdir): assert result == 1, "Training failed" -def test_wandb_pickle(tmpdir): - """Verify that pickling trainer with wandb logger works.""" - tutils.reset_seed() - - wandb_dir = str(tmpdir) - logger = WandbLogger(save_dir=wandb_dir, anonymous=True) - assert logger is not None - - def test_neptune_pickle(tmpdir): """Verify that pickling trainer with neptune logger works.""" tutils.reset_seed()