-
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
Feature/3521 Enable purely iteration based training #4086
Feature/3521 Enable purely iteration based training #4086
Conversation
can you set your Black to ignore ' and " with |
Codecov Report
@@ Coverage Diff @@
## release/1.2-dev #4086 +/- ##
=================================================
+ Coverage 89% 93% +4%
=================================================
Files 164 117 -47
Lines 12218 8977 -3241
=================================================
- Hits 10928 8350 -2578
+ Misses 1290 627 -663 |
@richardqiu can you write a completely separate test and try not to modify the existing tests? A good place to put the test is in trainer/flags/test_min_max_steps_epochs.py |
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.
please add a different test and try not to touch current tests
589a471
to
0db3507
Compare
This pull request is now in conflict... :( |
Hey @richardqiu, Would you mind updating your PR ? Best, |
0db3507
to
b9f6b69
Compare
Hello @richardqiu! Thanks for updating this PR.
Comment last updated at 2021-01-27 16:15:46 UTC |
Stop training after this number of steps. | ||
If both max_epochs and max_steps are specified, training will stop if either max_steps or max_epochs have been | ||
reached (earliest). |
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.
the documentation for min/max_epochs above needs to be updated too
epochs = range(self.current_epoch, self.max_epochs) if self.max_epochs else count(self.current_epoch) | ||
for epoch in epochs: |
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.
what happens if self.max_epochs
is None
, and self.max_steps
is large enough that we make more than 1 pass through the data? the count(self.current_epoch)
would return an iterable over a single value right? does that mean the loop would stop too early?
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.
Don't believe so, unless I'm misunderstanding? the count()
iterator is indefinite/doesn't raise StopIteration
.
trainer = Trainer( | ||
default_root_dir=tmpdir, | ||
min_epochs=0, | ||
max_steps=3, | ||
min_steps=0, | ||
weights_summary=None, | ||
) |
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.
could you also test with a larger max_steps value? i want to test a case where trainer.current_epoch
should be > 1 even if max_epochs
is None
def test_min_steps_only(tmpdir): | ||
""" | ||
Tests that min_steps can be used without min_epochs | ||
""" | ||
|
||
model = BoringModel() | ||
|
||
trainer = Trainer( | ||
default_root_dir=tmpdir, | ||
min_steps=3, | ||
max_epochs=2, | ||
weights_summary=None, | ||
) | ||
|
||
trainer.fit(model) |
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.
- are there other min/max epoch test cases that could be moved into this file?
- we should comprehensively test all possibilities for min/max epochs/steps. i think that's 8 test cases, which you could parameterize
3c68864
to
992f4e2
Compare
There are two failing tests in |
@richardqiu This is also coming from the rebasing when we introduced lightning optimizer in #4658 . Seems like the rebasing skipped the added arguments there. |
This pull request is now in conflict... :( |
@richardqiu are you still working on this PR? |
@richardqiu as it is a feature I am changing the target branch to feat 1.2, mind rebase pr and resolve conflicts? Thx your contribution and feel free to ping us back if you need something or need some help... 🐰 |
@Borda I'll take this up and re-submit it |
@ananthsub I believe this PR could resolve this Issue as well. Do let me know if I could help here. |
Thanks, I appreciate it! Apologies for the long delays here folks, and thanks for the feedback I've gotten here so far! |
Continues Lightning-AI#4086
What does this PR do?
Fixes #3521
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃