Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed a redundant warning with ModelCheckpoint(monitor=None) callback #9875

Merged
merged 55 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
74e5364
Update README.md
Programmer-RD-AI Oct 6, 2021
e0af7c2
Update README.md
Programmer-RD-AI Oct 6, 2021
b2a1372
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2021
864b400
Create evaluation.py
Programmer-RD-AI Oct 6, 2021
9e74636
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2021
818e5fe
Update README.md
Programmer-RD-AI Oct 6, 2021
5f86d08
Update evaluation.py
Programmer-RD-AI Oct 6, 2021
2413629
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2021
d004722
Create evaluation.py
Programmer-RD-AI Oct 6, 2021
741bec7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2021
725b1cc
Create evaluation.py
Programmer-RD-AI Oct 6, 2021
646c929
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2021
8f4916c
Update evaluation.py
Programmer-RD-AI Oct 7, 2021
543195c
Create nlp.py
Programmer-RD-AI Oct 7, 2021
c08ed59
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 7, 2021
d22b3a4
Update evaluation.py
Programmer-RD-AI Oct 7, 2021
992023d
Create evaluation.py
Programmer-RD-AI Oct 7, 2021
28a7670
Update nlp.py
Programmer-RD-AI Oct 7, 2021
4751e27
Update nlp.py
Programmer-RD-AI Oct 7, 2021
f727207
Update evaluation.py
Programmer-RD-AI Oct 7, 2021
e3a3acc
Create evaluation.py
Programmer-RD-AI Oct 7, 2021
c410db0
Update nlp.py
Programmer-RD-AI Oct 7, 2021
03a5dcc
Update nlp.py
Programmer-RD-AI Oct 7, 2021
e053747
Update requirements.txt
Programmer-RD-AI Oct 7, 2021
267085a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 7, 2021
78528a0
Update evaluation.py
Programmer-RD-AI Oct 7, 2021
8510097
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 7, 2021
3981c0f
Create data_loader.py
Programmer-RD-AI Oct 7, 2021
577e746
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 7, 2021
bf7315c
Update nlp.py
Programmer-RD-AI Oct 7, 2021
24fda2b
Update evaluation.py
Programmer-RD-AI Oct 7, 2021
e8323af
Update data_loader.py
Programmer-RD-AI Oct 7, 2021
713d6fa
Update nlp.py
Programmer-RD-AI Oct 7, 2021
5662aff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 7, 2021
7cf2978
Update data_loader.py
Programmer-RD-AI Oct 7, 2021
618ac57
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 7, 2021
c9563f9
Update requirements.txt
Programmer-RD-AI Oct 8, 2021
20a9705
Update model_checkpoint.py
Programmer-RD-AI Oct 8, 2021
45f1373
Delete evaluation.py
Programmer-RD-AI Oct 8, 2021
7faf2ac
Delete data_loader.py
Programmer-RD-AI Oct 8, 2021
6df1cae
Merge branch 'PyTorchLightning:master' into master
Programmer-RD-AI Oct 8, 2021
fe9c5cc
Delete nlp.py
Programmer-RD-AI Oct 9, 2021
500b1f0
Update requirements.txt
Programmer-RD-AI Oct 9, 2021
dfaeb64
Update model_checkpoint.py
Programmer-RD-AI Oct 9, 2021
2162f62
Update README.md
Programmer-RD-AI Oct 10, 2021
83f379e
Update pytorch_lightning/callbacks/model_checkpoint.py
Programmer-RD-AI Oct 11, 2021
fecfbc8
Update CHANGELOG.md
Programmer-RD-AI Oct 11, 2021
7086701
Merge branch 'PyTorchLightning:master' into master
Programmer-RD-AI Oct 11, 2021
3dc3337
Update test_model_checkpoint.py
Programmer-RD-AI Oct 11, 2021
a3e7581
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 11, 2021
acf6e28
Update model_checkpoint.py
Programmer-RD-AI Oct 11, 2021
73c0ae9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 11, 2021
c56bcb8
update
rohitgr7 Oct 11, 2021
ad6259d
update
rohitgr7 Oct 11, 2021
4a51af5
chlog update
rohitgr7 Oct 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed `TrainerProperties` mixin and moved property definitions directly into `Trainer` ([#9495](https://github.com/PyTorchLightning/pytorch-lightning/pull/9495))


- Removed a redundant warning with `ModelCheckpoint(monitor=None)` callback ([#9875](https://github.com/PyTorchLightning/pytorch-lightning/pull/9875))


### Fixed


Expand Down
8 changes: 2 additions & 6 deletions pytorch_lightning/callbacks/model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ModelCheckpoint(Callback):

Raises:
MisconfigurationException:
If ``save_top_k`` is neither ``None`` nor more than or equal to ``-1``,
If ``save_top_k`` is smaller than ``-1``,
if ``monitor`` is ``None`` and ``save_top_k`` is none of ``None``, ``-1``, and ``0``, or
if ``mode`` is none of ``"min"`` or ``"max"``.
ValueError:
Expand Down Expand Up @@ -427,11 +427,7 @@ def __validate_init_configuration(self) -> None:
f"ModelCheckpoint(save_top_k={self.save_top_k}, monitor=None) is not a valid"
" configuration. No quantity for top_k to track."
)
if self.save_last:
rank_zero_warn(
"ModelCheckpoint(save_last=True, save_top_k=None, monitor=None) is a redundant configuration."
" You can save the last checkpoint with ModelCheckpoint(save_top_k=None, monitor=None)."
)

if self.save_top_k == -1 and self.save_last:
rank_zero_info(
"ModelCheckpoint(save_last=True, save_top_k=-1, monitor=None)"
Expand Down
9 changes: 0 additions & 9 deletions tests/checkpointing/test_model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,6 @@ def test_none_monitor_top_k(tmpdir):
ModelCheckpoint(dirpath=tmpdir, save_top_k=1)


def test_none_monitor_save_last(tmpdir):
"""Test that a warning appears for save_last=True with monitor=None."""
with pytest.warns(UserWarning, match=r"ModelCheckpoint.*is a redundant.*"):
ModelCheckpoint(dirpath=tmpdir, save_last=True)
# These should not fail
ModelCheckpoint(dirpath=tmpdir, save_last=None)
ModelCheckpoint(dirpath=tmpdir, save_last=False)


def test_invalid_every_n_epochs(tmpdir):
"""Make sure that a MisconfigurationException is raised for a negative every_n_epochs argument."""
with pytest.raises(MisconfigurationException, match=r".*Must be >= 0"):
Expand Down