def _get_callbacks(self): callbacks = [ *self._get_extra_callbacks(), ModelCheckpoint( get_weights_path(self.output().path), save_best_only=True, monitor=self.monitor_metric, mode=self.monitor_mode, ), EarlyStopping( patience=self.early_stopping_patience, min_delta=self.early_stopping_min_delta, monitor=self.monitor_metric, mode=self.monitor_mode, ), CSVLogger(get_history_path(self.output().path)), TensorBoard(get_tensorboard_logdir(self.task_id), write_graph=False), ] if self.gradient_norm_clipping: callbacks.append( GradientNormClipping( self.gradient_norm_clipping, self.gradient_norm_clipping_type ) ) return callbacks
def test_not_best_only(self): self.assertTrue( isinstance(ModelCheckpoint(save_best_only=False), Interval))
def test_best_only(self): self.assertTrue(isinstance(ModelCheckpoint(save_best_only=True), Best))