Use `trainer.call_hook` in the evaluation loop (#7626)
This commit is contained in:
parent
3d4dd28bec
commit
603ef2cf7f
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue