to [#50529030] fix easycv lr hook error

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/13069804
This commit is contained in:
wenmeng.zwm
2023-06-26 21:54:01 +08:00
committed by yuze.zyz
parent b6c40aaa87
commit 6ab85256af

View File

@@ -112,6 +112,9 @@ class LrSchedulerHook(Hook):
self.processor.step(trainer)
def _get_log_lr(self, trainer):
# forward compatibility with AddLrLogHook in EasyCV
if not hasattr(self, 'processor'):
self.processor = LrSchedulerProcessor()
cur_lr = self.processor.get_current_lr(trainer)
# only record lr of the first param group
if isinstance(cur_lr, list):