From 43bbc78123dd57bbe256b37f2cb0b54ca724fa8a Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Fri, 15 Jul 2022 18:37:15 +0000 Subject: [PATCH] adapt test --- .../pipeline_latent_diffusion_uncond.py | 6 ++++-- tests/test_modeling_utils.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py b/src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py index 5d6ece34..74d748f2 100644 --- a/src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py +++ b/src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py @@ -36,7 +36,8 @@ class LatentDiffusionUncondPipeline(DiffusionPipeline): self.scheduler.set_timesteps(num_inference_steps) for t in tqdm.tqdm(self.scheduler.timesteps): - model_output = self.unet(image, t) + with torch.no_grad(): + model_output = self.unet(image, t) if isinstance(model_output, dict): model_output = model_output["sample"] @@ -46,5 +47,6 @@ class LatentDiffusionUncondPipeline(DiffusionPipeline): image = self.scheduler.step(model_output, t, image, eta)["prev_sample"] # decode image with vae - image = self.vqvae.decode(image) + with torch.no_grad(): + image = self.vqvae.decode(image) return {"sample": image} diff --git a/tests/test_modeling_utils.py b/tests/test_modeling_utils.py index 60a79282..4aa30c64 100755 --- a/tests/test_modeling_utils.py +++ b/tests/test_modeling_utils.py @@ -1070,7 +1070,8 @@ class PipelineTesterMixin(unittest.TestCase): @slow def test_ldm_uncond(self): - ldm = LatentDiffusionUncondPipeline.from_pretrained("fusing/latent-diffusion-celeba-256", ldm=True) +# ldm = LatentDiffusionUncondPipeline.from_pretrained("fusing/latent-diffusion-celeba-256", ldm=True) + ldm = LatentDiffusionUncondPipeline.from_pretrained("CompVis/latent-diffusion-celeba-256") generator = torch.manual_seed(0) image = ldm(generator=generator, num_inference_steps=5)["sample"]