Skip to content

Commit e9127f4

Browse files
authored
Update seed.py
1 parent 2cab7e2 commit e9127f4

File tree

1 file changed

+4
-1
lines changed
  • src/lightning/fabric/utilities

1 file changed

+4
-1
lines changed

src/lightning/fabric/utilities/seed.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ def pl_worker_init_function(worker_id: int, rank: Optional[int] = None) -> None:
108108
if _NUMPY_AVAILABLE:
109109
import numpy as np
110110

111-
np.random.seed(seed_sequence[3] & 0xFFFFFFFF) # numpy takes 32-bit seed only
111+
ss = np.random.SeedSequence([base_seed, worker_id, global_rank])
112+
np_rng_seed = ss.generate_state(4)
113+
114+
np.random.seed(np_rng_seed)
112115

113116

114117
def _generate_seed_sequence(base_seed: int, worker_id: int, global_rank: int, count: int) -> List[int]:

0 commit comments

Comments
 (0)