Update seed_everything() (#6843)

* Update seed.py

* Update pytorch_lightning/utilities/seed.py

Co-authored-by: thomas chaton <thomas@grid.ai>

* Update seed.py

* Update seed.py

* Update seed.py

Co-authored-by: thomas chaton <thomas@grid.ai>
This commit is contained in:
Roger Shieh 2021-04-07 19:17:48 +08:00 committed by GitHub
parent b7a22ba046
commit a2c605785a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,8 @@ def seed_everything(seed: Optional[int] = None) -> int:
rank_zero_warn(f"{seed} is not in bounds, numpy accepts from {min_seed_value} to {max_seed_value}")
seed = _select_seed_randomly(min_seed_value, max_seed_value)
# using `log.info` instead of `rank_zero_info`,
# so users can verify the seed is properly set in distributed training.
log.info(f"Global seed set to {seed}")
os.environ["PL_GLOBAL_SEED"] = str(seed)
random.seed(seed)