-
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 global step update when the epoch is skipped #7677
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7677 +/- ##
======================================
- Coverage 93% 92% -0%
======================================
Files 200 200
Lines 12955 12965 +10
======================================
- Hits 11991 11964 -27
- Misses 964 1001 +37 |
@@ -229,26 +229,6 @@ def train_dataloader(self): | |||
trainer.fit(model) | |||
|
|||
|
|||
@pytest.mark.parametrize('max_epochs,batch_idx_', [(2, 5), (3, 8), (4, 12)]) |
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.
Moved the test since it is testing more of the training loop internals than the model hook itself.
model = CurrentModel() | ||
trainer = Trainer(max_epochs=max_epochs, limit_train_batches=10) | ||
trainer.fit(model) | ||
if batch_idx_ > trainer.num_training_batches - 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.
This if was not running previously with the previous condition
* Fix global step update when the epoch is skipped * Update CHANGELOG * Move test
* Fix global step update when the epoch is skipped * Update CHANGELOG * Move test
* Fix global step update when the epoch is skipped * Update CHANGELOG * Move test
What does this PR do?
When the epoch is skipped (
on_train_batch_start
returns-1
),global_step
is still updated.This to me is wrong, even though we have tests for the previous behavior.
Added by @ydcjeff in #3700
Part of #7357
Before submitting
PR review