Skip to content

Commit

Permalink
Avoid the same batch sequence among workers. (#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
shishaochen authored Aug 25, 2021
1 parent 96bc025 commit 0004484
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deepmd/entrypoints/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ def _do_work(jdata: Dict[str, Any], run_opt: RunOptions, is_compress: bool = Fal
else:
ipt_type_map = type_map

#  init random seed
# init random seed of data systems
seed = jdata["training"].get("seed", None)
if seed is not None:
# avoid the same batch sequence among workers
seed += run_opt.my_rank
seed = seed % (2 ** 32)
dp_random.seed(seed)

Expand Down

0 comments on commit 0004484

Please sign in to comment.