Skip to content

Fix/inpainting followups#2319

Merged
kohya-ss merged 3 commits intodevfrom
fix/inpainting-followups
May 5, 2026
Merged

Fix/inpainting followups#2319
kohya-ss merged 3 commits intodevfrom
fix/inpainting-followups

Conversation

@kohya-ss
Copy link
Copy Markdown
Owner

@kohya-ss kohya-ss commented May 5, 2026

Follow up for #2309.

kohya-ss added 3 commits May 5, 2026 21:48
…hDataset

ControlNetDataset.__init__ constructs an internal DreamBoothDataset via
positional arguments. PR #2309 inserted a new train_inpainting parameter
into DreamBoothDataset.__init__ between prior_loss_weight and
debug_dataset, but this delegate call was not updated, so every
subsequent positional argument was shifted by one slot:

  - train_inpainting       <- received debug_dataset (bool, type-correct
                              but logically wrong: enables inpainting whenever
                              debug mode is on)
  - debug_dataset          <- received validation_split (float)
  - validation_split       <- received validation_seed (int)
  - validation_seed        <- received resize_interpolation (str)
  - resize_interpolation   <- received skip_image_resolution (tuple)
  - skip_image_resolution  <- defaulted to None (missing)

This breaks ControlNet training entirely. Forward the dataset's own
train_inpainting attribute to keep the delegate consistent.
Commit ff7945d (PR #2309) fixed the masks/masked_images batch shapes from
[B,1,1,H,W]/[B,1,C,H,W] to [B,1,H,W]/[B,C,H,W] and replaced the per-item
F.interpolate loop with a single batched call in fine_tune.py, train_db.py,
train_network.py, and sdxl_train.py — but train_textual_inversion.py was
missed.

After ff7945d batch["masks"] is [B,1,H,W]; iterating over it yields
[1,H,W] slices. F.interpolate on a 3D tensor with a 2-element size argument
performs 1D interpolation and errors on the dimension mismatch, so
textual-inversion inpainting training crashes on the first step.

Replace the loop+stack with the same single-call form used by the other
training scripts, and drop the now-redundant .reshape() workaround.
@kohya-ss kohya-ss merged commit 7879ebc into dev May 5, 2026
3 checks passed
@kohya-ss kohya-ss deleted the fix/inpainting-followups branch May 5, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant