-
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
Add LightningCLI(run=False|True)
#8751
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8751 +/- ##
=======================================
- Coverage 93% 89% -4%
=======================================
Files 169 169
Lines 14068 14069 +1
=======================================
- Hits 13038 12461 -577
- Misses 1030 1608 +578 |
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.
looks the same as mine #8251 which you blocked :P
Co-authored-by: Adrian Wälchli <[email protected]>
Co-authored-by: Adrian Wälchli <[email protected]>
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.
Since there will be multiple ways of using LightningCLI there is one thing that could be done to prevent mistakes. When run==True
after running, the Trainer instance could be modified overriding the fit
, test
, etc. methods such that it shows an error instead of running.
This would limit those who want to fit with |
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.
Because the entire design is focused on getting up-and-running as easily as possible. Setting it to
We can remove that issue from the "fixes" list. This PR adds support for having the choice
The CLI docs only mention that it is designed to run
This is entirely fair, running
Again, #7508 will make it opt-in as providing a subcommand will be a requirement with |
Co-authored-by: Adrian Wälchli <[email protected]>
What does this PR do?
Fixes #8615, #8251
Part of #7508
After discussing with @mauvilsa, we came to the conclusion that the solution of having a
__init__(run: bool)
flag to disablefit
is better than doing it by not passing a subcommand:This is because there is no case where the user would go from doing
python script.py fit <some_args>
topython script.py <some_args>
without code changes because to do so, the user would need to writecli.trainer.fit(cli.model)
anyways after the CLI instantiation.With that in consideration, we require the user to explicitly set
run=False
.This way, you have to really mess up to run
fit
twice accidentally.Does your PR introduce any breaking changes? If yes, please list them.
None
Before submitting
PR review