Skip to content

Commit

Permalink
Merge pull request #2477 from bmaltais/2475-is-not-recognized-as-an-i…
Browse files Browse the repository at this point in the history
…nternal-or-external-command

Catch when accelerate command is not found
  • Loading branch information
bmaltais authored May 9, 2024
2 parents f8b30fe + 73822af commit 2a188b0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
7 changes: 6 additions & 1 deletion kohya_gui/dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,12 @@ def train_model(
log.info(max_train_steps_info)
log.info(f"lr_warmup_steps = {lr_warmup_steps}")

run_cmd = [rf'{get_executable_path("accelerate")}', "launch"]
accelerate_path = get_executable_path("accelerate")
if accelerate_path == "":
log.error("accelerate not found")
return TRAIN_BUTTON_VISIBLE

run_cmd = [rf'{accelerate_path}', "launch"]

run_cmd = AccelerateLaunch.run_cmd(
run_cmd=run_cmd,
Expand Down
7 changes: 6 additions & 1 deletion kohya_gui/finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,12 @@ def train_model(
lr_warmup_steps = 0
log.info(f"lr_warmup_steps = {lr_warmup_steps}")

run_cmd = [rf'{get_executable_path("accelerate")}', "launch"]
accelerate_path = get_executable_path("accelerate")
if accelerate_path == "":
log.error("accelerate not found")
return TRAIN_BUTTON_VISIBLE

run_cmd = [rf'{accelerate_path}', "launch"]

run_cmd = AccelerateLaunch.run_cmd(
run_cmd=run_cmd,
Expand Down
7 changes: 6 additions & 1 deletion kohya_gui/lora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,12 @@ def train_model(
log.info(f"stop_text_encoder_training = {stop_text_encoder_training}")
log.info(f"lr_warmup_steps = {lr_warmup_steps}")

run_cmd = [rf'{get_executable_path("accelerate")}', "launch"]
accelerate_path = get_executable_path("accelerate")
if accelerate_path == "":
log.error("accelerate not found")
return TRAIN_BUTTON_VISIBLE

run_cmd = [rf'{accelerate_path}', "launch"]

run_cmd = AccelerateLaunch.run_cmd(
run_cmd=run_cmd,
Expand Down
7 changes: 6 additions & 1 deletion kohya_gui/textual_inversion_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,12 @@ def train_model(
log.info(f"stop_text_encoder_training = {stop_text_encoder_training}")
log.info(f"lr_warmup_steps = {lr_warmup_steps}")

run_cmd = [rf'{get_executable_path("accelerate")}', "launch"]
accelerate_path = get_executable_path("accelerate")
if accelerate_path == "":
log.error("accelerate not found")
return TRAIN_BUTTON_VISIBLE

run_cmd = [rf'{accelerate_path}', "launch"]

run_cmd = AccelerateLaunch.run_cmd(
run_cmd=run_cmd,
Expand Down

0 comments on commit 2a188b0

Please sign in to comment.