From 6d24bd4b613332c8ce8dc57b49b4dee822c87126 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Wed, 27 Jan 2021 00:29:21 +0100 Subject: [PATCH 1/3] new section + legacy 1.1.6 --- CHANGELOG.md | 18 ++++++++++++++++++ tests/checkpointing/test_legacy_checkpoints.py | 1 + 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c76415f75700..c486c80ae99b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [unreleased.Bugfixes] - YYYY-MM-DD + +### Added + + +### Changed + + +### Deprecated + + +### Removed + + +### Fixed + + + ## [1.1.6] - 2021-01-26 ### Changed diff --git a/tests/checkpointing/test_legacy_checkpoints.py b/tests/checkpointing/test_legacy_checkpoints.py index 577362e65f1c9..9bde70425644a 100644 --- a/tests/checkpointing/test_legacy_checkpoints.py +++ b/tests/checkpointing/test_legacy_checkpoints.py @@ -47,6 +47,7 @@ "1.1.3", "1.1.4", "1.1.5", + "1.1.6", ]) def test_resume_legacy_checkpoints(tmpdir, pl_version): path_dir = os.path.join(LEGACY_CHECKPOINTS_PATH, pl_version) From cb12b589b8e3f203c1b538bc53a053a661e34f21 Mon Sep 17 00:00:00 2001 From: SeanNaren Date: Wed, 27 Jan 2021 00:06:03 +0000 Subject: [PATCH 2/3] Clean up override test, fix function name --- tests/models/test_hooks.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/models/test_hooks.py b/tests/models/test_hooks.py index 62d17515119cd..5788e2ca3e12b 100644 --- a/tests/models/test_hooks.py +++ b/tests/models/test_hooks.py @@ -94,11 +94,9 @@ def training_epoch_end(self, outputs): def test_training_epoch_end_metrics_collection_on_override(tmpdir): """ Test that batch end metrics are collected when training_epoch_end is overridden at the end of an epoch. """ - num_epochs = 1 class LoggingCallback(pl.Callback): - - def on_train_epoch_end(self, trainer, pl_module): + def on_train_epoch_start(self, trainer, pl_module): self.len_outputs = 0 def on_train_epoch_end(self, trainer, pl_module, outputs): @@ -110,7 +108,6 @@ def on_train_epoch_start(self): self.num_train_batches = 0 def training_epoch_end(self, outputs): # Overridden - pass return def on_train_batch_end(self, outputs, batch, batch_idx, dataloader_idx): @@ -129,19 +126,20 @@ def on_train_batch_end(self, outputs, batch, batch_idx, dataloader_idx): callback = LoggingCallback() trainer = Trainer( - max_epochs=num_epochs, + max_epochs=1, default_root_dir=tmpdir, overfit_batches=2, callbacks=[callback], ) - result = trainer.fit(overridden_model) + trainer.fit(overridden_model) + # outputs from on_train_batch_end should be accessible in on_train_epoch_end hook + # if training_epoch_end is overridden assert callback.len_outputs == overridden_model.num_train_batches - # outputs from on_train_batch_end should be accessible in on_train_epoch_end hook if training_epoch_end is overridden - result = trainer.fit(not_overridden_model) - assert callback.len_outputs == 0 + trainer.fit(not_overridden_model) # outputs from on_train_batch_end should be empty + assert callback.len_outputs == 0 @pytest.mark.skipif(not torch.cuda.is_available(), reason="test requires GPU machine") From 1213b985cce7b3edf8463fa224e645e4ff3ce1ea Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Wed, 27 Jan 2021 01:16:29 +0100 Subject: [PATCH 3/3] . --- tests/models/test_hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/models/test_hooks.py b/tests/models/test_hooks.py index 5788e2ca3e12b..b5773bee87358 100644 --- a/tests/models/test_hooks.py +++ b/tests/models/test_hooks.py @@ -96,6 +96,7 @@ def test_training_epoch_end_metrics_collection_on_override(tmpdir): """ Test that batch end metrics are collected when training_epoch_end is overridden at the end of an epoch. """ class LoggingCallback(pl.Callback): + def on_train_epoch_start(self, trainer, pl_module): self.len_outputs = 0