Commit 24c1ec26 authored by Yuxin Wu's avatar Yuxin Wu

Improve warning messages when checking the initial parameters

parent e79d74f8
...@@ -273,10 +273,11 @@ class ScheduledHyperParamSetter(HyperParamSetter): ...@@ -273,10 +273,11 @@ class ScheduledHyperParamSetter(HyperParamSetter):
v = self._get_value_to_set_at_point(p) or v v = self._get_value_to_set_at_point(p) or v
actual_value = self.param.get_value() actual_value = self.param.get_value()
if v is not None and v != actual_value: if v is not None and v != actual_value:
logger.warn("According to the schedule, parameter '{}' should become {} at the current point. " logger.warn("According to scheduler {}, parameter '{}' should become {} at the current point. "
"However its current value is {}. " "However its current value is {}. "
"You may want to check whether your initialization of the parameter is as expected".format( "If this is the only scheduler being used, you may want to check whether your "
self.param.readable_name, v, actual_value)) "initialization of the parameter is as expected".format(
self, self.param.readable_name, v, actual_value))
def _get_value_to_set_at_point(self, point): def _get_value_to_set_at_point(self, point):
""" """
...@@ -310,6 +311,9 @@ class ScheduledHyperParamSetter(HyperParamSetter): ...@@ -310,6 +311,9 @@ class ScheduledHyperParamSetter(HyperParamSetter):
if self._step: if self._step:
self.trigger() self.trigger()
def __str__(self):
return "ScheduledHyperParamSetter(schedule={})".format(self.schedule)
class HyperParamSetterWithFunc(HyperParamSetter): class HyperParamSetterWithFunc(HyperParamSetter):
""" Set the parameter by a function of epoch num and old value. """ """ Set the parameter by a function of epoch num and old value. """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment