-
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
fix incomplete progress bar when refresh_rate > num batches #4577
Conversation
this bugfix is a visual fix, I need to figure out how to write the unit test. somehow counting the number of times update is called. |
@awaelchli would it be idea for testing to subclass class MyProgressBar(ProgressBar):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._update_counter = 0
def init_train_tqdm(self):
bar = super().init_train_tqdm()
bar.update = self.counter_wrap(bar.update)
return bar
def counter_wrap(self, update):
def wrap(*args, **kwargs):
self._update_counter += 1
return update(*args, **kwargs)
return wrap |
Codecov Report
@@ Coverage Diff @@
## master #4577 +/- ##
=======================================
Coverage 93% 93%
=======================================
Files 118 118
Lines 8911 9030 +119
=======================================
+ Hits 8285 8403 +118
- Misses 626 627 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@awaelchli can you resolve the conflict? |
@ananyahjha93 resolved, thanks! |
* fix progress bar overshoot * fix updates for partially incomplete main progress bar when val loop starts * add tests * chlog (cherry picked from commit 89e8796)
What does this PR do?
Fixes #4565
Fixes edge cases with num batches not being divisibale by refresh rate, leading to an incomplete the progress bar.
Tests here fail on master.
Example:
train_batches: 5, refresh_rate: 3
(master)
Epoch 0: 60%|██████ | 3/5 [00:00<00:00, 111.11it/s, loss=0.131]
(this branch)
Epoch 0: 100%|██████████| 5/5 [00:00<00:00, 125.00it/s, loss=0.124]