Skip to content

Commit d2026d0

Browse files
wfng92lstein
authored andcommitted
Fix error when init_mask=None and invert_mask=True
In the event where no `init_mask` is given and `invert_mask` is set to True, the script will raise the following error: ```bash AttributeError: 'NoneType' object has no attribute 'mode' ``` The new implementation will only run inversion when both variables are valid.
1 parent 0bc4ed1 commit d2026d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ldm/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def _make_images(
757757
elif text_mask:
758758
init_mask = self._txt2mask(image, text_mask, width, height, fit=fit)
759759

760-
if invert_mask:
760+
if init_mask and invert_mask:
761761
init_mask = ImageOps.invert(init_mask)
762762

763763
return init_image,init_mask

0 commit comments

Comments
 (0)