From 50a0a70f63462562b327026e5a94c67681619b77 Mon Sep 17 00:00:00 2001 From: ananthsub Date: Thu, 17 Feb 2022 23:04:23 -0800 Subject: [PATCH] Return early in `reset_seed` --- 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 efafc0afadd27..d79e2047c5b0c 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