Skip to content

Commit 0004484

Browse files
authored
Avoid the same batch sequence among workers. (#1032)
1 parent 96bc025 commit 0004484

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

deepmd/entrypoints/train.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ def _do_work(jdata: Dict[str, Any], run_opt: RunOptions, is_compress: bool = Fal
131131
else:
132132
ipt_type_map = type_map
133133

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

0 commit comments

Comments
 (0)