提交 30cbb183 编写于 作者: H HydrogenSulfate

update learning_rate.py

上级 2cfd8dd8
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
from __future__ import (absolute_import, division, print_function, from __future__ import (absolute_import, division, print_function,
unicode_literals) unicode_literals)
import types
from abc import abstractmethod from abc import abstractmethod
from typing import Union from typing import Union
...@@ -466,5 +466,12 @@ class ReduceOnPlateau(LRBase): ...@@ -466,5 +466,12 @@ class ReduceOnPlateau(LRBase):
if self.warmup_steps > 0: if self.warmup_steps > 0:
learning_rate = self.linear_warmup(learning_rate) 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) setattr(learning_rate, "by_epoch", self.by_epoch)
return learning_rate return learning_rate
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册