Skip to content

Commit a4457f1

Browse files
Use hydra.run.dir (not os.getcwd) for DDP subprocesses' run dir
1 parent 3d573d5 commit a4457f1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lightning/fabric/strategies/launchers/subprocess_script.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def _basic_subprocess_cmd() -> Sequence[str]:
143143

144144
def _hydra_subprocess_cmd(local_rank: int) -> Tuple[Sequence[str], str]:
145145
import __main__ # local import to avoid https://github.com/Lightning-AI/lightning/issues/15218
146+
from hydra.core.hydra_config import HydraConfig
146147
from hydra.utils import get_original_cwd, to_absolute_path
147148

148149
# when user is using hydra find the absolute path
@@ -154,6 +155,6 @@ def _hydra_subprocess_cmd(local_rank: int) -> Tuple[Sequence[str], str]:
154155
command += sys.argv[1:]
155156

156157
cwd = get_original_cwd()
157-
os_cwd = f'"{os.getcwd()}"'
158-
command += [f"hydra.run.dir={os_cwd}", f"hydra.job.name=train_ddp_process_{local_rank}"]
158+
run_dir = f'"{HydraConfig.get().run.dir}"'
159+
command += [f"hydra.run.dir={run_dir}", f"hydra.job.name=train_ddp_process_{local_rank}"]
159160
return command, cwd

0 commit comments

Comments
 (0)