From c9c6d454f138a31311af20516936cfebfa62d245 Mon Sep 17 00:00:00 2001 From: Mashiro <57566630+HAOCHENYE@users.noreply.github.com> Date: Thu, 14 Jul 2022 20:10:48 +0800 Subject: [PATCH] init OptimWrapper after resume (#362) --- mmengine/runner/runner.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mmengine/runner/runner.py b/mmengine/runner/runner.py index d41b1c6b..09cd2300 100644 --- a/mmengine/runner/runner.py +++ b/mmengine/runner/runner.py @@ -1592,16 +1592,17 @@ class Runner: self._val_loop) # type: ignore self.call_hook('before_run') + + # TODO: add a contextmanager to avoid calling `before_run` many times + # make sure checkpoint-related hooks are triggered after `before_run` + self.load_or_resume() + # Initiate inner count of `optim_wrapper`. self.optim_wrapper.initialize_count_status( self.model, self._train_loop.iter, # type: ignore self._train_loop.max_iters) # type: ignore - # TODO: add a contextmanager to avoid calling `before_run` many times - # make sure checkpoint-related hooks are triggered after `before_run` - self.load_or_resume() - self.train_loop.run() # type: ignore self.call_hook('after_run')