diff --git a/run-recipe.py b/run-recipe.py index ffa8506..f130dda 100755 --- a/run-recipe.py +++ b/run-recipe.py @@ -462,12 +462,13 @@ def generate_launch_script(recipe: dict[str, Any], overrides: dict[str, Any], is # (not needed for solo; no-ray uses PyTorch distributed instead) if is_solo or no_ray: import re - # Remove the entire line containing --distributed-executor-backend - # This handles multi-line commands with backslash continuations + # Remove just the flag and its value, not the whole line + command = re.sub(r'--distributed-executor-backend\s+\S+', '', command) + # Remove lines that are now empty or just a backslash continuation lines_list = command.split('\n') filtered_lines = [ - line for line in lines_list - if '--distributed-executor-backend' not in line + line for line in lines_list + if line.strip() not in ('', '\\') ] command = '\n'.join(filtered_lines)