-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Access to results #860
Comments
Use the |
Thanks so much! This was tough to know the right search terms for. |
yes but I agree that there's quite a bit of info that |
I'm just not great at it and for some reason keep ending up with a number that's different than the last displayed number. But it's much better than nothing, and I really appreciate the help. Thanks! |
This would be very useful. I have something like the following at the moment: logger.info(f"Reading things from '{file}'")
with file.open("rb") as f:
progress = tqdm(
f, desc="Reading things", unit="lines", unit_scale=True
)
for line_number, line in enumerate(progress):
# do something with line
logger.info(
f"Read {progress.format_dict['n']} things in"
f" {progress.format_interval(progress.format_dict['elapsed'])}"
f" ({(progress.format_dict['n'] / progress.format_dict['elapsed']):.2f}lines/s)"
) Besides this being unreadable code, the unit is not scaled in the logging statement. |
You can use |
Wow thanks. That's awesome. Who would have thought there is some non-documented functionality hidden away in the package? :) In that case it's only about unreadable code or the ease of extracting the relevant information. |
well there's https://tqdm.github.io/docs/tqdm/#format_sizeof |
You're absolutely right, but I only ever looked at https://github.com/tqdm/tqdm#documentation where it doesn't appear. I find it confusing to have multiple sources of documentation with varying content or levels of detail. |
tqdm gives nice human readable information about iterations per second. It would be great if we could access that information in order to log it, for times when we want to check the performance of a thing over time.
From this example: https://stackoverflow.com/questions/56677267/tqdm-extract-time-passed-time-remaining
0%| | 0/200 [00:00<?, ?it/s]
4%|▎ | 7/200 [00:00<00:02, 68.64it/s]
8%|▊ | 16/200 [00:00<00:02, 72.87it/s]
12%|█▎ | 25/200 [00:00<00:02, 77.15it/s]
17%|█▋ | 34/200 [00:00<00:02, 79.79it/s]
22%|██▏ | 43/200 [00:00<00:01, 79.91it/s]
26%|██▌ | 52/200 [00:00<00:01, 80.23it/s]
30%|███ | 61/200 [00:00<00:01, 82.13it/s]
....
100%|██████████| 200/200 [00:02<00:00, 81.22it/s]
I'd like to be able to retrieve 81.22, which is the last value for iterations per second. I have another script that uses tqdm and shows me k/s for a download, and I'd love to be able to log that over time. The goal is very much to have the values match what is shown (by tqdm) exactly, vs. calculating it separately and maybe coming close.
The text was updated successfully, but these errors were encountered: