From 331f97e0ededd9bb84caddab8744f53870189f98 Mon Sep 17 00:00:00 2001 From: Shaochen Shi Date: Wed, 25 Aug 2021 20:16:27 +0800 Subject: [PATCH] Avoid the same batch sequence among workers. (#1032) --- deepmd/entrypoints/train.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deepmd/entrypoints/train.py b/deepmd/entrypoints/train.py index 1a069428fe..bbb1e55bd2 100755 --- a/deepmd/entrypoints/train.py +++ b/deepmd/entrypoints/train.py @@ -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)