Get seconds per iteration in progress bar
See original GitHub issueHi there!
Love the package and the customisations so far!
I have a process that takes around 2 seconds per iteration. and would like to see something like 2.01s/it
.
The tqdm package automatically switches between iterations per second and seconds per iteration, depending on which one there are more of per second.
For example:
import time
from alive_progress import alive_bar
with alive_bar(3) as bar:
for i in range(3):
time.sleep(2)
bar()
from tqdm import tqdm
for i in tqdm(range(3)):
time.sleep(2)
bar()
Output:
alive-progress:
|█████████████▍ | ▆▄▂ 1/3 [33%] in 3s (0.3/s, eta: 4s)
tqdm:
33%|███████ | 1/3 [00:02<00:04, 2.01s/it]
I’ve seen the customisation of the stats
option in the alive_bar
, but don’t see a way how to change the {rate}
to {1/rate}
stats (bool|str): [True] configures the stats widget (123.4/s, eta: 12s)
↳ send a string with {rate} and {eta} to customize it
Thanks!
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
How to print iterations per second? - python
Here, I'm keeping a list of durations of last 10 iterations over which I can then use to get the average number of...
Read more >How to show iterations per second (like tdqm) #253
I think you are looking for the AdaptiveTransferSpeed: https://progressbar-2.readthedocs.io/en/latest/progressbar.widgets.html#progressbar.widgets.
Read more >Monitoring Iteration Progress with tqdm | by Peter Haferl
The way it works is by wrapping the iterable with the tqdm method and viola, a fully functional progress bar appears to save...
Read more >Training models with a progress bar - (Machine) Learning log.
You can see the nice output with 9.90it/s meaning an average speed of 9.90 iterations per second.
Read more >Training models with a progress bar | by Adam Oudad
tqdm is a Python library for adding progress bar. ... the nice output with 9.90it/s meaning an average speed of 9.90 iterations per...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t really mind either way, but in some cases it might be better to show the per-iteration speed. It’s easier to interpret “each one takes about 17 minutes” than “3.5 ones per hour” IMO. I think it should be configurable.
Really? I use mine for long-running, slow iterations, because of alive-progress’s amazingness. You don’t IMO only need to use a progress bar with short iterations.