From ddf6247c39f0bc20365262813941cf07ed88f944 Mon Sep 17 00:00:00 2001 From: Benjamin Bossan Date: Wed, 23 Dec 2020 19:29:08 +0100 Subject: [PATCH] Maintenance: python and pytorch versions updated (#733) * Update and document supported PyTorch versions - add 1.4.0 since we want to support 4 versions - use 1.7.1 instead of 1.7.0 - update documentation * Remove warning abt Python 3.5 support being dropped * Remove warning about CyclicLR step on epoch --- .github/workflows/testing.yml | 2 +- README.rst | 2 +- docs/user/installation.rst | 2 +- skorch/__init__.py | 8 -------- skorch/callbacks/lr_scheduler.py | 10 ---------- skorch/tests/callbacks/test_lr_scheduler.py | 18 ------------------ 6 files changed, 3 insertions(+), 39 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 082aba6e9..bc9403d22 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: python_version: ['3.6', '3.7', '3.8'] - torch_version: ['1.5.1+cpu', '1.6.0+cpu', '1.7.0+cpu'] + torch_version: ['1.4.0+cpu', '1.5.1+cpu', '1.6.0+cpu', '1.7.1+cpu'] os: [ubuntu-latest] steps: diff --git a/README.rst b/README.rst index 8db44a845..415350eec 100644 --- a/README.rst +++ b/README.rst @@ -234,10 +234,10 @@ instructions for PyTorch, visit the `PyTorch website `__. skorch officially supports the last four minor PyTorch versions, which currently are: -- 1.3.1 - 1.4.0 - 1.5.1 - 1.6.0 +- 1.7.1 However, that doesn't mean that older versions don't work, just that they aren't tested. Since skorch mostly relies on the stable part of diff --git a/docs/user/installation.rst b/docs/user/installation.rst index 28a0a7262..0f2222371 100644 --- a/docs/user/installation.rst +++ b/docs/user/installation.rst @@ -90,10 +90,10 @@ instructions for PyTorch, visit the `PyTorch website `__. skorch officially supports the last four minor PyTorch versions, which currently are: -- 1.3.1 - 1.4.0 - 1.5.1 - 1.6.0 +- 1.7.1 However, that doesn't mean that older versions don't work, just that they aren't tested. Since skorch mostly relies on the stable part of diff --git a/skorch/__init__.py b/skorch/__init__.py index 1d628b3e5..64f0f64c5 100644 --- a/skorch/__init__.py +++ b/skorch/__init__.py @@ -17,14 +17,6 @@ MIN_TORCH_VERSION = '1.1.0' -# TODO: remove in skorch 0.10.0 -if sys.version_info < (3, 6): - warnings.warn( - "Official support for Python 3.5 will be dropped starting from " - "skorch version 0.10.0", - FutureWarning, - ) - try: # pylint: disable=wrong-import-position import torch diff --git a/skorch/callbacks/lr_scheduler.py b/skorch/callbacks/lr_scheduler.py index a31bb7b73..04ec5435f 100644 --- a/skorch/callbacks/lr_scheduler.py +++ b/skorch/callbacks/lr_scheduler.py @@ -115,16 +115,6 @@ def initialize(self): self.policy_ = self._get_policy_cls() self.lr_scheduler_ = None self.batch_idx_ = 0 - # TODO: Remove this warning on 0.10 release - if (self.policy_ == TorchCyclicLR or self.policy_ == "TorchCyclicLR" - and self.step_every == 'epoch'): - warnings.warn( - "The LRScheduler now makes a step every epoch by default. " - "To have the cyclic lr scheduler update " - "every batch set step_every='batch'", - FutureWarning - ) - return self def _get_policy_cls(self): diff --git a/skorch/tests/callbacks/test_lr_scheduler.py b/skorch/tests/callbacks/test_lr_scheduler.py index 1a3d37901..1b140488b 100644 --- a/skorch/tests/callbacks/test_lr_scheduler.py +++ b/skorch/tests/callbacks/test_lr_scheduler.py @@ -241,26 +241,8 @@ def test_lr_scheduler_record_batch_step(self, classifier_module, classifier_data ) assert np.all(net.history[-1, 'batches', :, 'event_lr'] == new_lrs) - def test_cyclic_lr_with_epoch_step_warning(self, - classifier_module, - classifier_data): - msg = ("The LRScheduler now makes a step every epoch by default. " - "To have the cyclic lr scheduler update " - "every batch set step_every='batch'") - with pytest.warns(FutureWarning, match=msg) as record: - scheduler = LRScheduler( - TorchCyclicLR, base_lr=123, max_lr=999) - net = NeuralNetClassifier( - classifier_module, - max_epochs=0, - callbacks=[('scheduler', scheduler)], - ) - net.initialize() - assert len(record) == 1 - class TestReduceLROnPlateau: - def get_net_with_mock( self, classifier_data, classifier_module, monitor='train_loss'): """Returns a net with a mocked lr policy that allows to check what