40

I have a program in python that uses tqdm to output progress bar which shows like below:

  0%|          |   1/782 [00:02<31:00,  2.38s/it, loss=0.763 ]
 17%|█▋        | 134/782 [00:19<01:21,  7.98it/s, loss=0.375 ]
100%|██████████| 782/782 [03:50<00:00,  2.73it/s, loss=0.0193]
100%|█████████▉| 779/782 [03:47<00:00,  4.33it/s, loss=0.0175]
100%|█████████▉| 780/782 [03:48<00:00,  4.08it/s, loss=0.0172]
100%|█████████▉| 781/782 [03:48<00:00,  3.83it/s, loss=0.0195]

Lets take 2nd row:

 17%|█▋        | 134/782 [00:19<01:21,  7.98it/s, loss=0.375 ]

The fields in order are:

  • 17%: Percentage complete.
  • |█▋ | : Progress bar
  • 134/782: Number of items iterated over total number of items.
  • [00:19<01:21, 7.98it/s, loss=0.375 ]: Lets break this down below separately.
    • 00:19<01:21 : <<HERE>> Cant' figure this out.
    • 7.98it/s: iterations per second
    • loss=0.375: As the label says, it is the loss.

I understand that it is showing progress and stats like, iterations per second, loss obtained etc. However I am not able to precisely say what this time format ( 00:19<01:21 for example ) represents in every row? What does the < sign indicate?

tuxdna
  • 8,257
  • 4
  • 43
  • 61
  • 26
    This is "runtime" < "estimated time left". The time flows from right to left, i.e. the time that elapsed is substracted from the right (estimated time left) statement and added to the left (runtime). In the ideal case with a constant number of iterations per second, you start like `00:00<05:00` and end up with `05:00<00:00`. – Shintlor Oct 12 '18 at 10:30
  • why is that the first bar is not completed – Sam Mar 02 '23 at 09:42

2 Answers2

31

In the source code [1] there is a comment about it in format_meter method, it refers to {elapsed}<{remaining}

[1] https://github.com/tqdm/tqdm/blob/master/tqdm/std.py#L397

Yonas Kassa
  • 3,362
  • 1
  • 18
  • 27
8

The value 00:19 in 00:19<01:21, 7.98it/s is the elapsed time, while the value 1:21 is the remaining time, acording to the iterations per second value. Hence, it is not a static value.