Skip to content

Add masked loss#1207

Merged
kohya-ss merged 11 commits intodevfrom
masked-loss
Mar 26, 2024
Merged

Add masked loss#1207
kohya-ss merged 11 commits intodevfrom
masked-loss

Conversation

@kohya-ss
Copy link
Copy Markdown
Owner

Mask the loss value with conditioning image.

@Trojaner
Copy link
Copy Markdown

Trojaner commented Mar 24, 2024

snip
(was related to deepspeed)

@Trojaner Trojaner mentioned this pull request Mar 24, 2024
@Trojaner
Copy link
Copy Markdown

I cannot use reg images at the same time when conditioning_data_dir is defined, e.g.

[[datasets]]
caption_extension = ".txt"
resolution = [512,768]
  
  [[datasets.subsets]]
  image_dir = '/home/ml/checkpoints/regularization'
  is_reg = true
  class_tokens = "something"
  num_repeats = 1  

  [[datasets.subsets]]
  image_dir = '/home/ml/checkpoints/sd15/img'
  conditioning_data_dir = '/home/ml/checkpoints/sd15/mask'
  num_repeats = 10
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['datasets'][0]['subsets'][1]['conditioning_data_dir']

@kohya-ss
Copy link
Copy Markdown
Owner Author

Unfortunately ControlNetSubset (used in the masked loss) doesn't support is_reg attribute. Is it fine to set num_repeats of each subset (reg and train) to make the total number of reg images (num_repeats * num of reg images) same as the total number of training images? I think it is very similar to use is_reg for reg images.

@kohya-ss kohya-ss merged commit 5a2afb3 into dev Mar 26, 2024
@kohya-ss kohya-ss deleted the masked-loss branch March 26, 2024 10:41
nana0304 pushed a commit to nana0304/sd-scripts that referenced this pull request Jun 4, 2025
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.

2 participants