|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | | -import logging |
15 | 14 | import math |
16 | 15 | import os |
17 | 16 | import pickle |
@@ -776,30 +775,6 @@ def test_default_checkpoint_behavior(tmpdir): |
776 | 775 | assert ckpts[0] == "epoch=2-step=15.ckpt" |
777 | 776 |
|
778 | 777 |
|
779 | | -@pytest.mark.parametrize("max_epochs", [1, 2]) |
780 | | -@pytest.mark.parametrize("should_validate", [True, False]) |
781 | | -@pytest.mark.parametrize("save_last", [True, False]) |
782 | | -@pytest.mark.parametrize("verbose", [True, False]) |
783 | | -def test_model_checkpoint_save_last_warning( |
784 | | - tmpdir, caplog, max_epochs: int, should_validate: bool, save_last: bool, verbose: bool |
785 | | -): |
786 | | - """Tests 'Saving latest checkpoint...' log.""" |
787 | | - # set a high `every_n_epochs` to avoid saving in `on_train_epoch_end`. the message is only printed `on_train_end` |
788 | | - # but it would get skipped because it got already saved in `on_train_epoch_end` for the same global step |
789 | | - ckpt = ModelCheckpoint(dirpath=tmpdir, save_top_k=0, save_last=save_last, verbose=verbose, every_n_epochs=123) |
790 | | - trainer = Trainer( |
791 | | - default_root_dir=tmpdir, |
792 | | - callbacks=[ckpt], |
793 | | - max_epochs=max_epochs, |
794 | | - limit_train_batches=1, |
795 | | - limit_val_batches=int(should_validate), |
796 | | - ) |
797 | | - model = BoringModel() |
798 | | - with caplog.at_level(logging.INFO): |
799 | | - trainer.fit(model) |
800 | | - assert caplog.messages.count("Saving latest checkpoint...") == (verbose and save_last) |
801 | | - |
802 | | - |
803 | 778 | def test_model_checkpoint_save_last_checkpoint_contents(tmpdir): |
804 | 779 | """Tests that the save_last checkpoint contains the latest information.""" |
805 | 780 | seed_everything(100) |
|
0 commit comments