Skip to content

Commit 84d8f9a

Browse files
awaelchlilantiga
authored andcommitted
Close validation progress bar before updating training bar (#18503)
(cherry picked from commit a3f6e98)
1 parent e5c122c commit 84d8f9a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/lightning/pytorch/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
3636

3737

3838

39+
- Fixed visual glitch with the TQDM progress bar leaving the validation bar incomplete before switching back to the training display ([#18503](https://github.com/Lightning-AI/lightning/pull/18503))
40+
41+
3942
## [2.0.7] - 2023-08-14
4043

4144
### Added

src/lightning/pytorch/callbacks/progress/tqdm_progress.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ def on_sanity_check_start(self, *_: Any) -> None:
240240
self.train_progress_bar = Tqdm(disable=True) # dummy progress bar
241241

242242
def on_sanity_check_end(self, *_: Any) -> None:
243-
self.train_progress_bar.close()
244243
self.val_progress_bar.close()
244+
self.train_progress_bar.close()
245245

246246
def on_train_start(self, *_: Any) -> None:
247247
self.train_progress_bar = self.init_train_tqdm()
@@ -300,10 +300,10 @@ def on_validation_batch_end(
300300
_update_n(self.val_progress_bar, n)
301301

302302
def on_validation_end(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule") -> None:
303-
if self._train_progress_bar is not None and trainer.state.fn == "fit":
304-
self.train_progress_bar.set_postfix(self.get_metrics(trainer, pl_module))
305303
self.val_progress_bar.close()
306304
self.reset_dataloader_idx_tracker()
305+
if self._train_progress_bar is not None and trainer.state.fn == "fit":
306+
self.train_progress_bar.set_postfix(self.get_metrics(trainer, pl_module))
307307

308308
def on_test_start(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule") -> None:
309309
self.test_progress_bar = self.init_test_tqdm()

0 commit comments

Comments
 (0)