Skip to content

Commit 3d1ae50

Browse files
authored
Merge branch 'master' into test_skimage_ver
2 parents cd40e76 + 30ad3e2 commit 3d1ae50

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pytorch_lightning/callbacks/model_checkpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ def __validate_init_configuration(self):
246246
' configuration. No quantity for top_k to track.'
247247
)
248248
if self.save_last:
249-
raise MisconfigurationException(
250-
'ModelCheckpoint(save_last=True, monitor=None) is not a valid configuration.'
251-
' You can save the last checkpoint with ModelCheckpoint(save_top_k=None, monitor=None)'
249+
rank_zero_warn(
250+
'ModelCheckpoint(save_last=True, monitor=None) is a redundant configuration.'
251+
' You can save the last checkpoint with ModelCheckpoint(save_top_k=None, monitor=None).'
252252
)
253253

254254
def __init_ckpt_dir(self, filepath, dirpath, filename, save_top_k):

tests/checkpointing/test_model_checkpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ def test_none_monitor_top_k(tmpdir):
294294

295295
def test_none_monitor_save_last(tmpdir):
296296
""" Test that a warning appears for save_last=True with monitor=None. """
297-
with pytest.raises(
298-
MisconfigurationException, match=r'ModelCheckpoint\(save_last=True, monitor=None\) is not a valid.*'
297+
with pytest.warns(
298+
UserWarning, match=r'ModelCheckpoint\(save_last=True, monitor=None\) is a redundant.*'
299299
):
300300
ModelCheckpoint(dirpath=tmpdir, save_last=True)
301301
# These should not fail

0 commit comments

Comments
 (0)