Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #188 from delira-dev/trainer_and_logging_fix
Browse files Browse the repository at this point in the history
Fix trainer indent and default logging dir
  • Loading branch information
justusschock committed Aug 30, 2019
2 parents 84d5f27 + f73763f commit 9abd298
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions delira/training/base_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,27 +472,27 @@ def reduce_fn(batch):
is_best = self._is_better_val_scores(
best_val_score, new_val_score, val_score_mode)

# set best_val_score to new_val_score if is_best
if is_best:
best_val_score = new_val_score
# set best_val_score to new_val_score if is_best
if is_best:
best_val_score = new_val_score

if is_best and verbose:
logging.info("New Best Value at Epoch %03d : %03.3f" %
(epoch, best_val_score))
if is_best and verbose:
logging.info("New Best Value at Epoch %03d : %03.3f" %
(epoch, best_val_score))

# log metrics and loss values
for key, val in total_metrics.items():
log({"value": {"scalar_value": val, "tag": key
}})
# log metrics and loss values
for key, val in total_metrics.items():
log({"value": {"scalar_value": val, "tag": key
}})

self._at_epoch_end(total_metrics, val_score_key, epoch,
is_best)
self._at_epoch_end(total_metrics, val_score_key, epoch,
is_best)

is_best = False
is_best = False

# stop training (might be caused by early stopping)
if self.stop_training:
break
# stop training (might be caused by early stopping)
if self.stop_training:
break

return self._at_training_end()

Expand Down Expand Up @@ -719,8 +719,8 @@ def _reinitialize_logging(self, logging_type, logging_kwargs: dict):
_logging_kwargs.update(
{
"logdir":
os.path.join(os.path.basename(
os.path.basename(self.save_path)),
os.path.join(os.path.dirname(
os.path.dirname(self.save_path)),
"logs", "run_%02d" % self.fold),
"level": 0})

Expand Down

0 comments on commit 9abd298

Please sign in to comment.