Skip to content

Commit

Permalink
enabled early stopping/checkpooiunt even without val step
Browse files Browse the repository at this point in the history
  • Loading branch information
williamFalcon committed Mar 4, 2020
1 parent c60a392 commit 10b683b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pytorch_lightning/trainer/training_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,6 @@ def run_training_epoch(self):
# logs user requested information to logger
self.log_metrics(batch_step_metrics, grad_norm_dic)

# progress global step according to grads progress
if (self.batch_idx + 1) % self.accumulate_grad_batches == 0:
self.global_step += 1
self.total_batch_idx += 1

# ---------------
# CHECKPOINTING, EARLY STOPPING
# ---------------
Expand All @@ -484,6 +479,11 @@ def run_training_epoch(self):
if self.enable_early_stop:
self.early_stop_callback.check_metrics(self.callback_metrics)

# progress global step according to grads progress
if (self.batch_idx + 1) % self.accumulate_grad_batches == 0:
self.global_step += 1
self.total_batch_idx += 1

# max steps reached, end training
if self.max_steps is not None and self.max_steps == self.global_step:
break
Expand Down

0 comments on commit 10b683b

Please sign in to comment.