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

Fix finetuning meta file creation #2488

Merged
merged 1 commit into from
May 11, 2024
Merged
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
16 changes: 10 additions & 6 deletions kohya_gui/finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,8 @@ def train_model(
run_cmd.append(caption_extension)

# Add paths for the image folder and the caption metadata file
run_cmd.append(image_folder)
run_cmd.append(os.path.join(train_dir, caption_metadata_filename))
run_cmd.append(rf"{image_folder}")
run_cmd.append(rf"{os.path.join(train_dir, caption_metadata_filename)}")

# Include the full path flag if specified
if full_path:
Expand All @@ -641,16 +641,20 @@ def train_model(
# Prepare environment variables
env = setup_environment()

# Execute the command if not just for printing
if not print_only:
subprocess.run(run_cmd, env=env)

# create images buckets
if generate_image_buckets:
# Build the command to run the preparation script
run_cmd = [
PYTHON,
rf"{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),
pretrained_model_name_or_path,
rf"{image_folder}",
rf"{os.path.join(train_dir, caption_metadata_filename)}",
rf"{os.path.join(train_dir, latent_metadata_filename)}",
rf"{pretrained_model_name_or_path}",
"--batch_size",
str(batch_size),
"--max_resolution",
Expand Down
Loading