question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple ProgressBars Spamming

See original GitHub issue

🐛 Bug description

When using the ProgressBar handler for both my train and my evaluation engine train_pbar = ProgressBar() train_pbar.attach(train_engine) eval_pbar = ProgressBar(desc="Evaluation") eval_pbar.attach(eval_engine)

Or even when using common.setup_common_training_handlers from contrib.engines: common.setup_common_training_handlers(train_engine, to_save=to_save, save_every_iters=saving_rate, output_path=output_path, lr_scheduler=lr_scheduler, with_pbars=True, with_pbar_on_iters=True, log_every_iters=1, device=device)

The progress bars print a new line for every increment of the calculation (every iteration). My engines have some other handlers on both engines (early stopping handlers, some custom logging etc.), but there’s no printing that’s causing the error. It looks like so (for the second example, with setup_common_training_handlers): Epoch [1/10]: [504/6367] 8%|▊ [12:59<2:31:09] Epoch [1/10]: [504/6367] 8%|▊ [13:00<2:31:09] Epoch [1/10]: [505/6367] 8%|▊ [13:00<2:30:59] Epoch [1/10]: [505/6367] 8%|▊ [13:02<2:30:59] Epoch [1/10]: [506/6367] 8%|▊ [13:02<2:30:54] Epoch [1/10]: [506/6367] 8%|▊ [13:03<2:30:54] Epoch [1/10]: [507/6367] 8%|▊ [13:03<2:30:54] Epoch [1/10]: [507/6367] 8%|▊ [13:05<2:30:54] Epoch [1/10]: [508/6367] 8%|▊ [13:05<2:31:07]

Is there any common cause to this? My code is inspired from the example here. The trainer is created with create_supervised_trainer and the evaluator with create_supervised_evaluator.

Environment

  • PyTorch Version 1.4
  • Ignite Version 0.3.0
  • OS: Windows 10.0.18363 build 18363
  • Ignite installed using conda
  • Python version: 3.7.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bendboazcommented, Mar 28, 2020

@vfdev-5 definitely, thank you.

0reactions
ismael-elatificommented, Oct 31, 2021

To avoid tqdm printing each iteration on a new line, use this class instead :

from ignite.contrib.handlers.tqdm_logger import ProgressBar

class ProgressBarCustom(ProgressBar):
    """To force tqdm to overwrite previous line"""

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        from tqdm import tqdm as tqdm_base

        def tqdm_custom(*args, **kwargs):
            if hasattr(tqdm_base, '_instances'):
                for instance in list(tqdm_base._instances):
                    tqdm_base._decr_instances(instance)
            return tqdm_base(*args, **kwargs)

        self.pbar_cls = tqdm_custom

ProgressBarCustom(persist=False, desc="Training").attach(self.trainer)
ProgressBarCustom(persist=False, desc="Validation").attach(self.evaluator)

Kudos to this post

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML5 file uploading with multiple progress bars
I'm uploading multiple files via XmlHTTPRequest and HTML5. I have the uploading working fine, but I would like to have a progress bar...
Read more >
Building multi progress bar & getting slowdown. - Qt Forum
Hey I'm trying to build a multi progress bar with few bars displaying updates of some loop functions. I used QDialog as my...
Read more >
usage for --multi-progress - Google Groups
I need a window with a progress bar and pause/restart switch which have a label changing (paused/runing). Is it more clear ? ;)....
Read more >
Multiple Thread Progress Bar Control - CodeProject
Introduction. This article presents a control that creates threads and displays the progress and any messages sent from the thread. Background.
Read more >
Nested Progress Bars in PowerShell - Virtually Jason
You'll notice that I used two different variables to track my progress through each of the loops in the script, $i and $j....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found