From 8ede4a9c79c0c6eb7642521dadc3f4cb0672a3cd Mon Sep 17 00:00:00 2001 From: sneaxiy <32832641+sneaxiy@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:06:18 +0800 Subject: [PATCH] fix launch unorder (#55011) --- python/paddle/distributed/launch/context/args_envs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/paddle/distributed/launch/context/args_envs.py b/python/paddle/distributed/launch/context/args_envs.py index df81569be95..7dc410de345 100644 --- a/python/paddle/distributed/launch/context/args_envs.py +++ b/python/paddle/distributed/launch/context/args_envs.py @@ -222,4 +222,9 @@ def parse_args(): help="seconds to wait before elastic job begin to train", ) - return parser.parse_known_args() + args = parser.parse_known_args() + env_rank = int(os.getenv('PADDLE_TRAINER_ID', -1)) + if env_rank >= 0: + assert hasattr(args[0], "rank") + args[0].rank = env_rank + return args -- GitLab