Skip to content

Commit 244f365

Browse files
authored
Return early in reset_seed (#11983)
1 parent 4f68c63 commit 244f365

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytorch_lightning/utilities/seed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ def reset_seed() -> None:
8787
If :func:`pytorch_lightning.utilities.seed.seed_everything` is unused, this function will do nothing.
8888
"""
8989
seed = os.environ.get("PL_GLOBAL_SEED", None)
90+
if seed is None:
91+
return
9092
workers = os.environ.get("PL_SEED_WORKERS", "0")
91-
if seed is not None:
92-
seed_everything(int(seed), workers=bool(int(workers)))
93+
seed_everything(int(seed), workers=bool(int(workers)))
9394

9495

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

0 commit comments

Comments
 (0)