Skip to content

Commit

Permalink
Ensure global seed exists before passing into env subprocess.Popen ca…
Browse files Browse the repository at this point in the history
…ll (#3904)
  • Loading branch information
Sean Naren authored Oct 6, 2020
1 parent f55a9cf commit e4a56fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pytorch_lightning/accelerators/ddp_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def _call_children_scripts(self):
env_copy = os.environ.copy()
env_copy['LOCAL_RANK'] = f'{local_rank}'
env_copy['PL_DDP_PID'] = str(self.trainer.data_parallel_device_ids[local_rank])
env_copy['PL_GLOBAL_SEED'] = os.environ.get('PL_GLOBAL_SEED')
# remove env var if global seed not set
if os.environ.get('PL_GLOBAL_SEED') is None:
del env_copy['PL_GLOBAL_SEED']

# start process
# if hydra is available and initialized, make sure to set the cwd correctly
Expand Down

0 comments on commit e4a56fa

Please sign in to comment.