Make default tqdm dict overridable (#749)

* overridable tqdm_dict

* Slim down default tqdm_metrics

* gpu fix
This commit is contained in:
Vadim Bereznyuk
2020-02-05 06:24:43 -05:00
committed by GitHub
parent 734b28ed2d
commit 5035ce5474
3 changed files with 25 additions and 21 deletions
+2 -3
View File
@@ -295,7 +295,7 @@ class TrainerEvaluationLoopMixin(ABC):
desc = 'Testing' if test else 'Validating'
pbar = tqdm(desc=desc, total=max_batches, leave=test, position=position,
disable=not self.show_progress_bar, dynamic_ncols=True,
unit='batch', file=sys.stdout)
file=sys.stdout)
setattr(self, f'{"test" if test else "val"}_progress_bar', pbar)
# run evaluation
@@ -319,9 +319,8 @@ class TrainerEvaluationLoopMixin(ABC):
model.on_post_performance_check()
# add model specific metrics
tqdm_metrics = self.training_tqdm_dict
if not test:
self.main_progress_bar.set_postfix(**tqdm_metrics)
self.main_progress_bar.set_postfix(**self.training_tqdm_dict)
# close progress bar
if test: