Skip to content

Commit 60d915f

Browse files
make style
1 parent d1efefe commit 60d915f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def preprocess_image(image):
4545

4646

4747
def preprocess_mask(mask, scale_factor=8):
48-
4948
if not isinstance(mask, torch.FloatTensor):
5049
mask = mask.convert("L")
5150
w, h = mask.size
@@ -65,7 +64,8 @@ def preprocess_mask(mask, scale_factor=8):
6564
mask = mask.permute(0, 3, 1, 2)
6665
elif mask.shape[1] not in valid_mask_channel_sizes:
6766
raise ValueError(
68-
f"Mask channel dimension of size in {valid_mask_channel_sizes} should be second or fourth dimension, but received mask of shape {tuple(mask.shape)}"
67+
f"Mask channel dimension of size in {valid_mask_channel_sizes} should be second or fourth dimension,"
68+
f" but received mask of shape {tuple(mask.shape)}"
6969
)
7070
# (potentially) reduce mask channel dimension from 3 to 1 for broadcasting to latent shape
7171
mask = mask.mean(dim=1, keepdim=True)
@@ -515,7 +515,7 @@ def __call__(
515515
mask_image (`torch.FloatTensor` or `PIL.Image.Image`):
516516
`Image`, or tensor representing an image batch, to mask `image`. White pixels in the mask will be
517517
replaced by noise and therefore repainted, while black pixels will be preserved. If `mask_image` is a
518-
PIL image, it will be converted to a single channel (luminance) before use. If mask is a tensor, the
518+
PIL image, it will be converted to a single channel (luminance) before use. If mask is a tensor, the
519519
expected shape should be either `(B, H, W, C)` or `(B, C, H, W)`, where C is 1 or 3.
520520
strength (`float`, *optional*, defaults to 0.8):
521521
Conceptually, indicates how much to inpaint the masked area. Must be between 0 and 1. When `strength`

tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint_legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def test_stable_diffusion_inpaint_legacy(self):
213213

214214
assert image.shape == (1, 32, 32, 3)
215215
expected_slice = np.array([0.4941, 0.5396, 0.4689, 0.6338, 0.5392, 0.4094, 0.5477, 0.5904, 0.5165])
216-
216+
217217
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
218218
assert np.abs(image_from_tuple_slice.flatten() - expected_slice).max() < 1e-2
219219

0 commit comments

Comments
 (0)