mirror of
https://github.com/open-mmlab/mmengine.git
synced 2025-06-03 21:54:44 +08:00
init OptimWrapper after resume (#362)
This commit is contained in:
parent
45001a1f6f
commit
c9c6d454f1
@ -1592,16 +1592,17 @@ class Runner:
|
|||||||
self._val_loop) # type: ignore
|
self._val_loop) # type: ignore
|
||||||
|
|
||||||
self.call_hook('before_run')
|
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`.
|
# Initiate inner count of `optim_wrapper`.
|
||||||
self.optim_wrapper.initialize_count_status(
|
self.optim_wrapper.initialize_count_status(
|
||||||
self.model,
|
self.model,
|
||||||
self._train_loop.iter, # type: ignore
|
self._train_loop.iter, # type: ignore
|
||||||
self._train_loop.max_iters) # 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.train_loop.run() # type: ignore
|
||||||
self.call_hook('after_run')
|
self.call_hook('after_run')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user