Add features for models that may need a non masked loss such as inpainiting.

This commit is contained in:
Jaret Burkett
2026-06-22 10:59:17 -06:00
parent c133c55cf5
commit 820d534d6e
3 changed files with 7 additions and 1 deletions

View File

@@ -1382,7 +1382,7 @@ class SDTrainer(BaseSDTrainProcess):
clip_images = batch.clip_image_tensor.to(self.device_torch, dtype=dtype).detach()
mask_multiplier = torch.ones((noisy_latents.shape[0], 1, 1, 1), device=self.device_torch, dtype=dtype)
if batch.mask_tensor is not None:
if batch.mask_tensor is not None and self.sd.do_masked_loss:
with self.timer('get_mask_multiplier'):
# upsampling no supported for bfloat16
mask_multiplier = batch.mask_tensor.to(self.device_torch, dtype=torch.float16).detach()