fixed bag callback=False or None at trainer_io.py (#409)

This commit is contained in:
Hata Ryosuke 2019-10-23 02:07:48 +09:00 committed by William Falcon
parent 2924ebeda5
commit e7c12d936e
1 changed files with 4 additions and 4 deletions

View File

@ -151,10 +151,10 @@ class TrainerIOMixin(object):
'global_step': self.global_step
}
if self.checkpoint_callback is not None or self.checkpoint_callback is not False:
if self.checkpoint_callback is not None and self.checkpoint_callback is not False:
checkpoint['checkpoint_callback_best'] = self.checkpoint_callback.best
if self.early_stop_callback is not None or self.checkpoint_callback is not False:
if self.early_stop_callback is not None and self.checkpoint_callback is not False:
checkpoint['early_stop_callback_wait'] = self.early_stop_callback.wait
checkpoint['early_stop_callback_patience'] = self.early_stop_callback.patience
@ -207,10 +207,10 @@ class TrainerIOMixin(object):
:param checkpoint:
:return:
"""
if self.checkpoint_callback is not None or self.checkpoint_callback is not False:
if self.checkpoint_callback is not None and self.checkpoint_callback is not False:
self.checkpoint_callback.best = checkpoint['checkpoint_callback_best']
if self.early_stop_callback is not None or self.early_stop_callback is not False:
if self.early_stop_callback is not None and self.early_stop_callback is not False:
self.early_stop_callback.wait = checkpoint['early_stop_callback_wait']
self.early_stop_callback.patience = checkpoint['early_stop_callback_patience']