Skip to content
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

Replace progressbar2 by tqdm #502

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Replace progressbar2 by tqdm #502

merged 1 commit into from
Sep 3, 2024

Conversation

chaozg
Copy link
Contributor

@chaozg chaozg commented Sep 2, 2024

fixed #501

Issue:

progressbar2 has display issues in jupyter notebooks where its progress information can easily span several pages. For example, sampler.sample(200) will give a screen output like the following

  0% (0 of 200) |                        | Elapsed Time: 0:00:00 ETA:  --:--:--
  0% (1 of 200) |                        | Elapsed Time: 0:00:00 ETA:   0:00:28
  2% (4 of 200) |                        | Elapsed Time: 0:00:00 ETA:   0:00:14
  2% (5 of 200) |                        | Elapsed Time: 0:00:00 ETA:   0:00:36
  3% (6 of 200) |                        | Elapsed Time: 0:00:01 ETA:   0:00:39
  3% (7 of 200) |                        | Elapsed Time: 0:00:01 ETA:   0:00:36
  4% (8 of 200) |                        | Elapsed Time: 0:00:01 ETA:   0:00:36
  5% (10 of 200) |#                      | Elapsed Time: 0:00:01 ETA:   0:00:29
  5% (11 of 200) |#                      | Elapsed Time: 0:00:01 ETA:   0:00:29

... many lines of display, omitted here (note by Charlie)

 97% (194 of 200) |##################### | Elapsed Time: 0:00:35 ETA:   0:00:00
 97% (195 of 200) |##################### | Elapsed Time: 0:00:35 ETA:   0:00:00
 98% (196 of 200) |##################### | Elapsed Time: 0:00:35 ETA:   0:00:00
 98% (197 of 200) |##################### | Elapsed Time: 0:00:35 ETA:   0:00:00
 99% (198 of 200) |##################### | Elapsed Time: 0:00:35 ETA:   0:00:00
 99% (199 of 200) |##################### | Elapsed Time: 0:00:36 ETA:   0:00:00
100% (200 of 200) |######################| Elapsed Time: 0:00:36 Time:  0:00:36

Solution:

tqdm is a package that works similarly to progressbar2 but does not suffer the above-described display problem.

With tqdm, the same line displaying the progress information will be dynamically updated (as expected).

100%|██████████| 200/200 [00:02<00:00, 68.48it/s]

@chaozg chaozg requested a review from nabriis September 2, 2024 20:36
Copy link
Collaborator

@nabriis nabriis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. tqdm looks like a better package. Also has no dependencies.

@chaozg chaozg requested a review from jakobsj September 2, 2024 20:50
@chaozg
Copy link
Contributor Author

chaozg commented Sep 2, 2024

LGTM. tqdm looks like a better package. Also has no dependencies.

Great, now I'm requesting @jakobsj 's review 😄

Copy link
Contributor

@jakobsj jakobsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@chaozg chaozg merged commit 6731d72 into main Sep 3, 2024
6 checks passed
@chaozg chaozg deleted the fix_progress_bar branch September 3, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

solve display problem of progresspar2
3 participants