1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

make style

This commit is contained in:
Daniel Gu
2023-08-21 22:19:46 -07:00
parent 092bd0e9e9
commit fa7759293a
2 changed files with 5 additions and 6 deletions

View File

@@ -585,7 +585,7 @@ class StableDiffusionInpaintPipeline(
"Since strength < 1. initial latents are to be initialised as a combination of Image + Noise."
"However, either the image or the noise timestep has not been provided."
)
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
if return_image_latents or (latents is None and not is_strength_max):
@@ -768,9 +768,8 @@ class StableDiffusionInpaintPipeline(
[`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
force_unmasked_unchanged (`bool`, *optional*):
Whether to force the unmasked areas of `image` to remain exactly the same after inpainting for a model
with 9 UNet channels. If the UNet has only 4 channels, then the unmasked areas will always be forced
to remain unchanged, and setting `force_unmasked_unchanged` to `False` in this case will raise an
error.
with 9 UNet channels. If the UNet has only 4 channels, then the unmasked areas will always be forced to
remain unchanged, and setting `force_unmasked_unchanged` to `False` in this case will raise an error.
Examples:

View File

@@ -266,7 +266,7 @@ class StableDiffusionInpaintPipelineFastTests(
inputs["strength"] = 0.01
with self.assertRaises(ValueError):
sd_pipe(**inputs).images
def test_stable_diffusion_inpaint_force_unmasked_unchanged(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator
components = self.get_dummy_components()
@@ -364,7 +364,7 @@ class StableDiffusionSimpleInpaintPipelineFastTests(StableDiffusionInpaintPipeli
expected_slice = np.array([0.4925, 0.4967, 0.4100, 0.5234, 0.5322, 0.4532, 0.5805, 0.5877, 0.4151])
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
def test_stable_diffusion_inpaint_force_unmasked_unchanged_false(self):
device = "cpu" # ensure determinism for the device-dependent torch.Generator
components = self.get_dummy_components()