Skip to content

Commit

Permalink
fix warn to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouzaida committed Dec 27, 2022
1 parent 508e561 commit 3948bd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mmengine/hooks/checkpoint_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def after_val_epoch(self, runner, metrics):
metrics (dict): Evaluation results of all metrics
"""
if len(metrics) == 0:
runner.logger.warn(
runner.logger.warning(
'Since `metrics` is an empty dict, the behavior to save '
'the best checkpoint will be skipped in this evaluation.')
return
Expand Down
4 changes: 2 additions & 2 deletions tests/test_hooks/test_checkpoint_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_after_val_epoch(self, tmp_path):
runner.work_dir = tmp_path
runner.epoch = 9
runner.model = Mock()
runner.logger.warn = Mock()
runner.logger.warning = Mock()
runner.message_hub = MessageHub.get_instance('test_after_val_epoch')

with pytest.raises(ValueError):
Expand All @@ -164,7 +164,7 @@ def test_after_val_epoch(self, tmp_path):
checkpoint_hook = CheckpointHook(
interval=2, by_epoch=True, save_best='auto')
checkpoint_hook.after_val_epoch(runner, {})
runner.logger.warn.assert_called_once()
runner.logger.warning.assert_called_once()

# test error when number of rules and metrics are not same
with pytest.raises(AssertionError) as assert_error:
Expand Down

0 comments on commit 3948bd4

Please sign in to comment.