From fdc69f9d58ecbe584e659321284032a8f1efc6bd Mon Sep 17 00:00:00 2001 From: Leymore Date: Mon, 21 Aug 2023 16:58:36 +0800 Subject: [PATCH] [Fix] local runner debug (#238) --- opencompass/runners/local.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/opencompass/runners/local.py b/opencompass/runners/local.py index ee570a4d..2fa86d46 100644 --- a/opencompass/runners/local.py +++ b/opencompass/runners/local.py @@ -59,7 +59,18 @@ class LocalRunner(BaseRunner): for task in tasks: task = TASKS.build(dict(type=self.task_cfg.type, cfg=task)) task_name = task.name - task.run() + # get cmd + mmengine.mkdir_or_exist('tmp/') + param_file = f'tmp/{os.getpid()}_params.py' + task.cfg.dump(param_file) + cmd = task.get_command(cfg_path=param_file, + template='{task_cmd}') + # run in subprocess if starts with torchrun etc. + if cmd.startswith('python'): + task.run() + else: + subprocess.run(cmd, shell=True, text=True) + os.remove(param_file) status.append((task_name, 0)) else: import torch