Skip to content

Commit

Permalink
Fix #4375: Always use trainer.global_step for step (#4376)
Browse files Browse the repository at this point in the history
* Fix #4375: Always use trainer.global_step for step

* Changelog

* Remove superflous use "epoch"

* Update Changelog

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
  • Loading branch information
moi90 and SkafteNicki authored Nov 22, 2020
1 parent 299de5d commit 8601268
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Changed

- Consistently use `step=trainer.global_step` in `LearningRateMonitor` independently of `logging_interval` ([#4376](https://github.com/PyTorchLightning/pytorch-lightning/pull/4376))


- Tuner algorithms will be skipped if `fast_dev_run=True` ([#3903](https://github.com/PyTorchLightning/pytorch-lightning/pull/3903))


Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/callbacks/lr_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def on_train_epoch_start(self, trainer, *args, **kwargs):
latest_stat = self._extract_stats(trainer, interval)

if trainer.logger is not None and latest_stat:
trainer.logger.log_metrics(latest_stat, step=trainer.current_epoch)
trainer.logger.log_metrics(latest_stat, step=trainer.global_step)

def _extract_stats(self, trainer, interval: str) -> Dict[str, float]:
latest_stat = {}
Expand Down

0 comments on commit 8601268

Please sign in to comment.