Skip to content

Commit

Permalink
Return early in reset_seed (#11983)
Browse files Browse the repository at this point in the history
  • Loading branch information
ananthsub authored Feb 25, 2022
1 parent 4f68c63 commit 244f365
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytorch_lightning/utilities/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ def reset_seed() -> None:
If :func:`pytorch_lightning.utilities.seed.seed_everything` is unused, this function will do nothing.
"""
seed = os.environ.get("PL_GLOBAL_SEED", None)
if seed is None:
return
workers = os.environ.get("PL_SEED_WORKERS", "0")
if seed is not None:
seed_everything(int(seed), workers=bool(int(workers)))
seed_everything(int(seed), workers=bool(int(workers)))


def pl_worker_init_function(worker_id: int, rank: Optional[int] = None) -> None: # pragma: no cover
Expand Down

0 comments on commit 244f365

Please sign in to comment.