Skip to content

Commit

Permalink
Write progress bar to stdout (#531)
Browse files Browse the repository at this point in the history
* Default write progress bar to stdout

* Change validation progress too
  • Loading branch information
tullie authored and williamFalcon committed Nov 21, 2019
1 parent 7324dd9 commit c1ecca4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pytorch_lightning/trainer/evaluation_loop_mixin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import torch
import sys
import tqdm

from pytorch_lightning.utilities.debugging import MisconfigurationException
Expand Down Expand Up @@ -120,7 +121,7 @@ def run_evaluation(self, test=False):
desc = 'Testing' if test else 'Validating'
pbar = tqdm.tqdm(desc=desc, total=max_batches, leave=test, position=position,
disable=not self.show_progress_bar, dynamic_ncols=True,
unit='batch')
unit='batch', file=sys.stdout)
setattr(self, f'{"test" if test else "val"}_progress_bar', pbar)

# run evaluation
Expand Down
4 changes: 3 additions & 1 deletion pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os
import sys
import warnings
import logging

Expand Down Expand Up @@ -460,7 +461,8 @@ def run_pretrain_routine(self, model):

# init progress bar
pbar = tqdm.tqdm(leave=True, position=2 * self.process_position,
disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch')
disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch',
file=sys.stdout)
self.main_progress_bar = pbar

# clear cache before training
Expand Down

0 comments on commit c1ecca4

Please sign in to comment.