Skip to content

Commit

Permalink
deprecate
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Dec 6, 2021
1 parent ceb98f1 commit a314c73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,10 @@ def pre_dispatch(self, trainer: "pl.Trainer") -> None:
def dispatch(self, trainer: "pl.Trainer") -> None:
"""Hook to do something before the training/evaluation/prediction starts."""
self.precision_plugin.dispatch(trainer)

def post_dispatch(self, trainer: "pl.Trainer") -> None:
"""Hook to do something after the training/evaluation/prediction finishes.
.. deprecated:: v1.6
This method has been deprecated in v1.6 and will be removed in v1.7. Use :meth:`teardown` instead.
"""
6 changes: 6 additions & 0 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,12 @@ def _log_hyperparams(self) -> None:
self.logger.save()

def _post_dispatch(self):
if is_overridden("post_dispatch", self.training_type_plugin, parent=TrainingTypePlugin):
rank_zero_deprecation(
f"`{self.training_type_plugin.__class__.__name__}.post_dispatch()` has been deprecated in v1.6 and"
" will be removed in v1.7. Move your implementation to"
f" `{self.training_type_plugin.__class__.__name__}.teardown()` instead."
)
# these `teardown` calls are here instead of in `_call_teardown_hook` since they are internal teardowns
# which need to happen before.
self.accelerator.teardown()
Expand Down

0 comments on commit a314c73

Please sign in to comment.