From 603ef2cf7fbb561bb5ade6fa06df81f2a3f2c84c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Fri, 21 May 2021 12:54:52 +0200 Subject: [PATCH] Use `trainer.call_hook` in the evaluation loop (#7626) --- pytorch_lightning/trainer/evaluation_loop.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/pytorch_lightning/trainer/evaluation_loop.py b/pytorch_lightning/trainer/evaluation_loop.py index c6da2c57ae..f048297892 100644 --- a/pytorch_lightning/trainer/evaluation_loop.py +++ b/pytorch_lightning/trainer/evaluation_loop.py @@ -250,21 +250,6 @@ class EvaluationLoop(object): self.trainer.dev_debugger.track_eval_loss_history(batch_idx, dataloader_idx, output) def on_evaluation_epoch_end(self) -> None: - model_ref = self.trainer.lightning_module hook_name = "on_test_epoch_end" if self.trainer.testing else "on_validation_epoch_end" - - self.trainer._reset_result_and_set_fx_name(hook_name) - - with self.trainer.profiler.profile(hook_name): - - if hasattr(self.trainer, hook_name): - on_evaluation_epoch_end_hook = getattr(self.trainer, hook_name) - on_evaluation_epoch_end_hook() - - if is_overridden(hook_name, model_ref): - model_hook_fx = getattr(model_ref, hook_name) - model_hook_fx() - - self.trainer._cache_logged_metrics() - + self.trainer.call_hook(hook_name) self.trainer.call_hook('on_epoch_end')