-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
For a given code example:
from tqdm import tqdm
from time import sleep
for i in tqdm(range(100)):
sleep(1.5)
the output looks like this:
6%|▌ | 6/100 [00:09<02:21, 1.50s/it]
but I'd like for it to actually force display it/s (generally, units per time, and possibly vice versa) so the output for this example (with the required parameter being set) would look like this:
6%|▌ | 6/100 [00:09<02:21, 0.67it/s]
as I see it, this functionality is basically hardcoded in std.py (in master branch as of October 2021)
Line 450 in fc69d5d
rate_fmt = rate_inv_fmt if inv_rate and inv_rate > 1 else rate_noinv_fmt |
a modification of the above code line to
rate_fmt = rate_noinv_fmt
achieves desired behavior, but does not parametrize the rate when each format should be displayed. As I see it right now, that hardcoded "1" may be the only thing in need of parametrizing (possibly member variable) with an option to be set to None or so to completely ignore it, while a default value could be 1 to preserve current default behavior.
is there any other way right now to "force" set it/s mode (without changing tqdm code), and possibly set the "trigger" frequency? Say, for example, one might want to display seconds per iteration only if rate is lower than 1e-3 it/s)...
EDIT 1, 2 & 3: sentence formatting, spelling, punctuation