-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
LitProgressBar ignores TQDM_MINITERS #19346
Comments
@wouterzwerink Could you point us to the documentation for this? There is nothing like that in the source code of tqdm: https://github.com/search?q=repo:tqdm/tqdm+TQDM_MINITERS&type=code |
@awaelchli yes unfortunately it's documented quite poorly! Applied here to TQDM: |
Thanks for the pointer! My blind guess is that maybe it doesn't work because we have our own small wrapper:
(but it should, since we call super().__init__ ?). Might be worth investigating what's going on there. Apart from that, I don't see why it wouldn't work because we're using tqdm quite plainly.
|
I tried just adding if __name__ == "__main__":
import time
for _ in Tqdm(range(100)):
time.sleep(1) to the bottom of this file: pytorch-lightning/src/lightning/pytorch/callbacks/progress/tqdm_progress.py Calling it with and without TQDM_MINITERS set works as expected. So this Tqdm wrapper class is not causing any issues |
Ah ok, I understand what miniters does now. miniters=x is supposed to update only ever x ticks. But then it makes sense that it doesn't work with Lightning because our progress bar implementation directly updates the bar (there is no iterable over it), because we need explicit and dynamic control over when the update happens: pytorch-lightning/src/lightning/pytorch/callbacks/progress/tqdm_progress.py Lines 448 to 451 in 1a59097
But I think there is probably an easy way to incorporate it by just grabbing the default refresh rate from the env variable here: pytorch-lightning/src/lightning/pytorch/callbacks/progress/tqdm_progress.py Lines 429 to 434 in 1a59097
Would you be interested to contribute this change? |
Bug description
tqdm supports setting the environment variable
TQDM_MINITERS
to reduce the frequency of progress bar updates.Since lightning trainer defaults to a TQDM progress bar, I expected this to work for lightning. However, pytorch lightnings trainer seems to ignore this.
What version are you seeing the problem on?
v2.1
How to reproduce the bug
Error messages and logs
Environment
Current environment
More info
No response
cc @awaelchli
The text was updated successfully, but these errors were encountered: