Skip to content

Commit b38c9b1

Browse files
update expected results of slow tests (huggingface#268)
* update expected results of slow tests * relax sum and mean tests * Print shapes when reporting exception * formatting * fix sentence * relax test_stable_diffusion_fast_ddim for gpu fp16 * relax flakey tests on GPU * added comment on large tolerences * black * format * set scheduler seed * added generator * use np.isclose * set num_inference_steps to 50 * fix dep. warning * update expected_slice * preprocess if image * updated expected results * updated expected from CI * pass generator to VAE * undo change back to orig * use orignal * revert back the expected on cpu * revert back values for CPU * more undo * update result after using gen * update mean * set generator for mps * update expected on CI server * undo * use new seed every time * cpu manual seed * reduce num_inference_steps * style * use generator for randn Co-authored-by: Patrick von Platen <[email protected]>
1 parent c498924 commit b38c9b1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

models/vae.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,11 @@ def decode(self, z: torch.FloatTensor, return_dict: bool = True) -> Union[Decode
557557
return DecoderOutput(sample=dec)
558558

559559
def forward(
560-
self, sample: torch.FloatTensor, sample_posterior: bool = False, return_dict: bool = True
560+
self,
561+
sample: torch.FloatTensor,
562+
sample_posterior: bool = False,
563+
return_dict: bool = True,
564+
generator: Optional[torch.Generator] = None,
561565
) -> Union[DecoderOutput, torch.FloatTensor]:
562566
r"""
563567
Args:
@@ -570,7 +574,7 @@ def forward(
570574
x = sample
571575
posterior = self.encode(x).latent_dist
572576
if sample_posterior:
573-
z = posterior.sample()
577+
z = posterior.sample(generator=generator)
574578
else:
575579
z = posterior.mode()
576580
dec = self.decode(z).sample

pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def __call__(
178178

179179
self.scheduler.set_timesteps(num_inference_steps, **extra_set_kwargs)
180180

181-
if not isinstance(init_image, torch.FloatTensor):
181+
if isinstance(init_image, PIL.Image.Image):
182182
init_image = preprocess(init_image)
183183

184184
# encode the init image into latents and scale the latents

0 commit comments

Comments
 (0)