Skip to content

Commit

Permalink
Merge ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
DubiousCactus committed May 31, 2024
1 parent effa80c commit 524cab4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/base_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,12 @@ def _plot(self, epoch: int, train_losses: List[float], val_losses: List[float]):
None
"""
plt.clf()
if project_conf.LOG_SCALE_PLOT:
if any(loss_val <= 0 for loss_val in train_losses + val_losses):
raise ValueError(
"Cannot plot on a log scale if there are non-positive losses."
)
if project_conf.LOG_SCALE_PLOT and any(
loss_val <= 0 for loss_val in train_losses + val_losses
):
raise ValueError(
"Cannot plot on a log scale if there are non-positive losses."
)
self._setup_plot(self._run_name, log_scale=project_conf.LOG_SCALE_PLOT)
plt.plot(
list(range(self._starting_epoch, epoch + 1)),
Expand Down

0 comments on commit 524cab4

Please sign in to comment.