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

[BUG] rich progress function abnormally when cooperating with torch #3149

Closed
Shaoqi-Wang opened this issue Oct 10, 2023 · 3 comments
Closed

Comments

@Shaoqi-Wang
Copy link

Shaoqi-Wang commented Oct 10, 2023

  • [ √] I've checked docs and closed issues for possible solutions.
  • [ √] I can't find my issue in the FAQ.

Describe the bug

rich progress bar can not update normally when torch imported, even torch is not referred anywhere

from rich.progress import Progress, TextColumn, BarColumn, TimeElapsedColumn, TimeRemainingColumn
import time
import torch
with Progress(TextColumn("[progress.description]{task.description}"),
              TextColumn("extra info: {task.fields[extra]}"),
              BarColumn(),
              TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
              TimeRemainingColumn(),
              TimeElapsedColumn()) as progress:
    epoch_tqdm = progress.add_task(description="epoch progress", total=10, extra=1)
    batch_tqdm = progress.add_task(description="batch progress", total=100, extra=1, start=False)
    time.sleep(10)
    for ep in range(10):
        progress.start_task(batch_tqdm)
        for batch in range(100):
            print("ep: {} batch: {}".format(ep, batch))
            progress.update(batch_tqdm, extra=1, advance=1)
            time.sleep(0.1)
        progress.update(epoch_tqdm, extra=1, advance=1)
        progress.reset(batch_tqdm, extra=0, start=False)

Platform

Click to expand

What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
Windows and windows terminal

I may ask you to copy and paste the output of the following commands. It may save some time if you do it now.
image below is expected to show a 'waiting' progress bar as False been asigned to 'start', but it doesn't. Furthermore, when manualy start the task, only cursor move forward as progress update, the progress bar itself does not change

image
image

If you're using Rich in a terminal:

python -m rich.diagnose
pip freeze | grep rich

image
image
image

If you're using Rich in a Jupyter Notebook, run the following snippet in a cell
and paste the output in your bug report.

from rich.diagnose import report
report()
@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@Shaoqi-Wang
Copy link
Author

problem solved!
torch automatically import tqdm which has conflict with rich, thus simply uninstall tqdm can fix the problem

@github-actions
Copy link

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant