Skip to content

In verbose mode, make the prefix of the progress bar fixed-length #182

Description

@npatki

Problem Description

When PAR is used in verbose mode, we show a progress bar (from tqdm) as well as stats about the progress, eg. the loss value.

The problem is that the stats change for each epoch. And if the stats end up taking up a different number of characters, then the entire progress bar "jumps" back and forth during the fitting process, which it hard to read. For example, if the discriminator score changes from positive to negative, the bar jumps as follows:

Loss (4.542):   8%|▊         | 10/128 [00:14<02:40,  1.36s/it]
Loss (-1.542):   8%|▊         | 10/128 [00:14<02:40,  1.36s/it]

Expected behavior

I expect that the prefix of the progress bar should be fixed-length not matter what the stats are. This would prevent the bar from jumping back and forth.

I suggest making all the displayed scores (for generators, disciminators, etc) 6-characters long:

  • First character is a + or - sign
  • Then there is a 2-digit number -- padded by a 0 if needed
  • Then a decimal point
  • Then the 2-digit decimal

For example:

Loss (+04.54):   8%|▊         | 10/128 [00:14<02:40,  1.36s/it]
Loss (-01.54):   8%|▊         | 10/128 [00:14<02:40,  1.36s/it]

Additional context

If the score is less than -99.99 or greater than +99.99 (very rare case), then we can just clip the displayed score to -99.99 and +99.99.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions