-
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/12804 Automatic Seeding of the CLI #12822
Feature/12804 Automatic Seeding of the CLI #12822
Conversation
…ning if None is passed. Implemented tests.
for more information, see https://pre-commit.ci
…torch-lightning into feature/12804_CLIautoseed
Co-authored-by: Carlos Mocholí <[email protected]>
for more information, see https://pre-commit.ci
Co-authored-by: Carlos Mocholí <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
…torch-lightning into feature/12804_CLIautoseed
for more information, see https://pre-commit.ci
Hey, I was just thinking about the pull_request again. |
You are correct @Schinkikami. I opened #13110 with a fix. |
@carmocca Does |
@adosar Yes: pytorch-lightning/src/lightning/pytorch/cli.py Lines 722 to 726 in 8b378f0
|
What does this PR do?
The argument
seed_default_value
of theLightningCLI
is changed to the typeOptional[Union[bool,int]] = True
(fromOptional[int] = None
). TheOptional
flag is set for backwards compatibility. Setting it toNone
has the same effect as setting it toFalse
, but raises arankzero - LightningDeprecationWarning
.If the value is set to
True
a valid (rangenp.iiinfo(np.int32).min
tonp.iiinfo(np.int32).max
) seed is drawn at random and added as default to theseed_everything
argument.The issue was discussed and approved in 12804. The type of
--seed_everything
is set toOptional[int32]
, as I do not think, that setting it toOptional[Union[bool,int]]
is required. By default the CLI now chooses a new seed with every instantiation, which can of course be overwritten with--seed_everything
from the CLI or a config file. The only time, one would like to set it toFalse
, would be if somewhere in the code the seed is already set, but in this case the automatic seeding should be disabled in the code (by settingseed_default_value
to False) and not in a config file with--seed_everything
.Choosing a seed outside of the valid seed range, raises and error and avoids unnoticed accidental mistakes.
The version in the deprecation warning still needs to be set.
Fixes #12804
For a motivation and discussion, have a look at the issue.
Does your PR introduce any breaking changes? If yes, please list them.
No.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃