From 21fa0346ea9f09f4f537caeb8b2fa319ecab4089 Mon Sep 17 00:00:00 2001 From: sneaxiy <32832641+sneaxiy@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:06:38 +0800 Subject: [PATCH] fix launch unorder (#55010) --- 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 9e0565b1c45..5eb00958ee6 100644 --- a/python/paddle/distributed/launch/context/args_envs.py +++ b/python/paddle/distributed/launch/context/args_envs.py @@ -200,4 +200,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