Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2325 quotes wrapping python path cause subprocess cant find target in v2403 #2338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kohya gui
Submodule kohya gui added at c1cd70
22 changes: 11 additions & 11 deletions kohya_gui/finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ def train_model(
if generate_caption_database:
# Define the command components
run_cmd = [
fr'"{PYTHON}"',
f'"{scriptdir}/sd-scripts/finetune/merge_captions_to_metadata.py"',
PYTHON,
fr"{scriptdir}/sd-scripts/finetune/merge_captions_to_metadata.py",
]

# Add the caption extension
Expand All @@ -594,7 +594,7 @@ def train_model(
# Prepare environment variables
env = os.environ.copy()
env["PYTHONPATH"] = (
f"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
fr"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
)
env["TF_ENABLE_ONEDNN_OPTS"] = "0"

Expand All @@ -606,8 +606,8 @@ def train_model(
if generate_image_buckets:
# Build the command to run the preparation script
run_cmd = [
fr'"{PYTHON}"',
f'"{scriptdir}/sd-scripts/finetune/prepare_buckets_latents.py"',
PYTHON,
fr"{scriptdir}/sd-scripts/finetune/prepare_buckets_latents.py",
image_folder,
os.path.join(train_dir, caption_metadata_filename),
os.path.join(train_dir, latent_metadata_filename),
Expand Down Expand Up @@ -640,7 +640,7 @@ def train_model(
# Copy and modify environment variables
env = os.environ.copy()
env["PYTHONPATH"] = (
f"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
fr"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
)
env["TF_ENABLE_ONEDNN_OPTS"] = "0"

Expand Down Expand Up @@ -694,7 +694,7 @@ def train_model(
lr_warmup_steps = 0
log.info(f"lr_warmup_steps = {lr_warmup_steps}")

run_cmd = [fr'"{get_executable_path("accelerate")}"', "launch"]
run_cmd = [get_executable_path("accelerate"), "launch"]

run_cmd = AccelerateLaunch.run_cmd(
run_cmd=run_cmd,
Expand All @@ -713,9 +713,9 @@ def train_model(
)

if sdxl_checkbox:
run_cmd.append(fr'"{scriptdir}/sd-scripts/sdxl_train.py"')
run_cmd.append(fr"{scriptdir}/sd-scripts/sdxl_train.py")
else:
run_cmd.append(fr'"{scriptdir}/sd-scripts/fine_tune.py"')
run_cmd.append(fr"{scriptdir}/sd-scripts/fine_tune.py")

in_json = (
f"{train_dir}/{latent_metadata_filename}"
Expand Down Expand Up @@ -869,7 +869,7 @@ def train_model(
log.error(f"Failed to write TOML file: {toml_file.name}")

run_cmd.append(f"--config_file")
run_cmd.append(fr'"{tmpfilename}"')
run_cmd.append(fr"{tmpfilename}")

# Initialize a dictionary with always-included keyword arguments
kwargs_for_training = {
Expand Down Expand Up @@ -900,7 +900,7 @@ def train_model(

env = os.environ.copy()
env["PYTHONPATH"] = (
f"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
fr"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
)
env["TF_ENABLE_ONEDNN_OPTS"] = "0"

Expand Down
14 changes: 14 additions & 0 deletions setup/validate_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
# Set up logging
log = setup_logging()

def check_path_with_space():
# Get the current working directory
cwd = os.getcwd()

# Check if the current working directory contains a space
if " " in cwd:
log.error("The path in which this python code is executed contain one or many spaces. This is not supported for running kohya_ss GUI.")
log.error("Please move the repo to a path without spaces, delete the venv folder and run setup.sh again.")
log.error("The current working directory is: " + cwd)
exit(1)

def check_torch():
# Check for toolkit
if shutil.which('nvidia-smi') is not None or os.path.exists(
Expand Down Expand Up @@ -89,6 +100,9 @@ def check_torch():

def main():
setup_common.check_repo_version()

check_path_with_space()

# Parse command line arguments
parser = argparse.ArgumentParser(
description='Validate that requirements are satisfied.'
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a steam punk skull with a gas mask , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a man with a skull on his head , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a woman with a helmet on her head , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a horned man with a goat head , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a man playing a piano , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a robot sitting on a rock , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a soldier with a helmet on , by darius kawasaki
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a painting of a giant crab with a large body , by darius kawasaki
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
solo,simple background,teeth,grey background,from side,no humans,mask,1other,science fiction,cable,gas mask,tube,steampunk,machine
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_2.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
no humans,what
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_3.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1girl,solo,nude,colored skin,monster,blue skin
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_4.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
solo,upper body,horns,from side,no humans,blood,1other
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_5.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
solo,1boy,male focus,mask,instrument,science fiction,realistic,music,gas mask
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_6.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
solo,no humans,mask,helmet,robot,mecha,1other,science fiction,damaged,gas mask,steampunk
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_7.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
solo,from side,no humans,mask,moon,helmet,portrait,1other,ambiguous gender,gas mask
1 change: 1 addition & 0 deletions test/img/10_darius kawasaki person/Dariusz_Zawadzki_8.cap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
outdoors,sky,cloud,no humans,monster,realistic,desert
Loading