-
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 gpus default for Trainer.add_argparse_args #6898
Conversation
Trainer.add_argparse_args
@@ -232,7 +232,6 @@ def add_argparse_args( | |||
|
|||
if arg == 'gpus' or arg == 'tpu_cores': | |||
use_type = _gpus_allowed_type | |||
arg_default = _gpus_arg_default | |||
|
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 is the fix.
we should not attach a function here, because if we pass it into our hparams, it will land in the checkpoint and risk not being able to unpickle.
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 😃
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.
Do you have any idea why the default was a function?
@carmocca totally no clue. Maybe someone confused it with the type, which can be a function that argparse uses to covert the input. |
(cherry picked from commit 9c9e2a0)
(cherry picked from commit 9c9e2a0)
(cherry picked from commit 9c9e2a0)
(cherry picked from commit 9c9e2a0)
What does this PR do?
Fixes #6549
Fixes #6263
The default for gpus and tpu_cores was a function, but it should be
None
as in the Trainer.This fixes a pickle issue, when the function is passed into the model via Model(**vars(args)).
It would prevent unpickling outside pytorch lightning (or when PL code changes).
Newly added test case fails on master.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃