diff --git a/ppcls/optimizer/learning_rate.py b/ppcls/optimizer/learning_rate.py index 958983f270e80a4a7e61a75b7027eeed47cee249..58195477fc93cf9972d16708fad568a374423330 100644 --- a/ppcls/optimizer/learning_rate.py +++ b/ppcls/optimizer/learning_rate.py @@ -14,7 +14,7 @@ from __future__ import (absolute_import, division, print_function, unicode_literals) - +import types from abc import abstractmethod from typing import Union @@ -466,5 +466,12 @@ class ReduceOnPlateau(LRBase): if self.warmup_steps > 0: learning_rate = self.linear_warmup(learning_rate) + # NOTE: Implement get_lr() method for class `ReduceOnPlateau`, + # which is called in `log_info` function + def get_lr(self): + return self.last_lr + + learning_rate.get_lr = types.MethodType(get_lr, learning_rate) + setattr(learning_rate, "by_epoch", self.by_epoch) return learning_rate