Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ananthsub committed Mar 11, 2021
1 parent 1a22d92 commit dd16af3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pytorch_lightning/callbacks/model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def __validate_init_configuration(self):
)
if self.every_n_train_steps > 0 and self.every_n_val_epochs > 0:
raise MisconfigurationException(
f'Invalid values for every_n_train_steps={self.every_n_train_steps} and every_n_val_epochs={self.every_n_val_epochs}.'
f'Invalid values for every_n_train_steps={self.every_n_train_steps}'
' and every_n_val_epochs={self.every_n_val_epochs}.'
'Both cannot be enabled at the same time.'
)
if self.monitor is None:
Expand Down
5 changes: 4 additions & 1 deletion tests/checkpointing/test_model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,10 @@ def test_invalid_every_n_train_steps(tmpdir):


def test_invalid_every_n_train_steps_val_epochs_combination(tmpdir):
""" Make sure that a MisconfigurationException is raised if both every_n_val_epochs and every_n_train_steps are enabled together. """
"""
Test that a MisconfigurationException is raised if both
every_n_val_epochs and every_n_train_steps are enabled together.
"""
with pytest.raises(MisconfigurationException, match=r'.*Both cannot be enabled at the same time'):
ModelCheckpoint(dirpath=tmpdir, every_n_train_steps=1, every_n_val_epochs=2)
# These should not fail
Expand Down

0 comments on commit dd16af3

Please sign in to comment.