From 244f365fae404dce833ec6bbb5dda6e46a8f8b6d Mon Sep 17 00:00:00 2001 From: ananthsub Date: Fri, 25 Feb 2022 15:58:27 -0800 Subject: [PATCH] Return early in `reset_seed` (#11983) --- pytorch_lightning/utilities/seed.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/utilities/seed.py b/pytorch_lightning/utilities/seed.py index efafc0afad..d79e2047c5 100644 --- a/pytorch_lightning/utilities/seed.py +++ b/pytorch_lightning/utilities/seed.py @@ -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