From 4f9c57e95d217f025c651bef5dcdfb2730d31c29 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Thu, 6 Feb 2025 13:26:23 -0500 Subject: [PATCH] check for src axolotl in PYTHONPATH before removing it --- src/axolotl/cli/cloud/modal_.py | 5 ++++- tests/e2e/multigpu/test_grpo.py | 0 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 tests/e2e/multigpu/test_grpo.py diff --git a/src/axolotl/cli/cloud/modal_.py b/src/axolotl/cli/cloud/modal_.py index bcc47ead9..52e8cc3c6 100644 --- a/src/axolotl/cli/cloud/modal_.py +++ b/src/axolotl/cli/cloud/modal_.py @@ -23,7 +23,10 @@ def run_cmd(cmd: str, run_folder: str, volumes=None): # modal workaround so it doesn't use the automounted axolotl new_env = copy.deepcopy(os.environ) if "PYTHONPATH" in new_env: - del new_env["PYTHONPATH"] + python_path = Path(new_env["PYTHONPATH"].split(":")[0]) + if python_path.joinpath("src", "axolotl").exists(): + # we don't want to use the automounted axolotl or unexpected behavior happens + del new_env["PYTHONPATH"] # Propagate errors from subprocess. if exit_code := subprocess.call( # nosec B603 diff --git a/tests/e2e/multigpu/test_grpo.py b/tests/e2e/multigpu/test_grpo.py new file mode 100644 index 000000000..e69de29bb