I'm working on a simple batch iterator that should be able to keep track of the progress when running through a full set of values. For that I'm using tqdm, but at the start of an iteration it's printing empty content.
Code:
for start_idx in trange(0, len(inputs) - batchsize + 1, batchsize):
excerpt = slice(start_idx, start_idx + batchsize)
Outputing something like:
Epoch: 0
100%|██████████| 1562/1562 [00:02<00:00, 630.24it/s]
0%| | 0/1562 [00:00<?, ?it/s]Epoch: 1
62%|██████▏ | 965/1562 [00:01<00:00, 623.74it/s]
I've had similar issues with progressbar module and I just had to swap the type of output for sys.stdout
but in this module I can't find a parameter to set that. Any suggestions?
Edit1: This is happening in PyCharm terminal
The clue is that Epoch: 1
at the end of the second line.
Somewhere in your code, you're printing that out, which throws tqdm
off; it would usually use a \r
(carriage return) character to return to the start of the line, but you're printing a newline character, so the previous line remains.