I'm using tqdm
's progress bar, and I'd like to shorten the bar itself by using an argument to indicate how many progress ticks the bar should have
So instead of this
Training (16): 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊| 983/984 [00:04<00:00, 242.42it/s, loss=0.0598]
I would get something like this
Training (16): 100%|█████████████| 983/984 [00:04<00:00, 242.42it/s, loss=0.0598]
I've explored the bar_format
argument in tqdm
's constructor, but couldn't figure out how to change it's size.
The relevant formatting code is: {bar:10}
-- if you want 10 characters of progress bar. In full, you would use it like this:
tqdm(iterator, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}')
or
tqdm(iterator, bar_format='{desc:<5.5}{percentage:3.0f}%|{bar:10}{r_bar}')
See also: https://github.com/tqdm/tqdm/issues/585