Skip to content

Commit

Permalink
Fix finetuning meta file creation (#2488)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais authored May 11, 2024
1 parent d010b0d commit 3b771f5
Showing 1 changed file with 10 additions and 6 deletions.
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

0 comments on commit 3b771f5

Please sign in to comment.