Skip to content

Commit 3669690

Browse files
committed
update
1 parent 8049117 commit 3669690

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/lora/test_lora_layers_peft.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ def test_sdxl_0_9_lora_three(self):
17141714
release_memory(pipe)
17151715

17161716
def test_sdxl_1_0_lora(self):
1717-
generator = torch.Generator().manual_seed(0)
1717+
generator = torch.Generator("cpu").manual_seed(0)
17181718

17191719
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
17201720
pipe.enable_model_cpu_offload()
@@ -1737,7 +1737,7 @@ def test_sdxl_lcm_lora(self):
17371737
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
17381738
pipe.enable_model_cpu_offload()
17391739

1740-
generator = torch.Generator().manual_seed(0)
1740+
generator = torch.Generator("cpu").manual_seed(0)
17411741

17421742
lora_model_id = "latent-consistency/lcm-lora-sdxl"
17431743

@@ -1766,7 +1766,7 @@ def test_sdv1_5_lcm_lora(self):
17661766
pipe.to("cuda")
17671767
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
17681768

1769-
generator = torch.Generator().manual_seed(0)
1769+
generator = torch.Generator("cpu").manual_seed(0)
17701770

17711771
lora_model_id = "latent-consistency/lcm-lora-sdv1-5"
17721772
pipe.load_lora_weights(lora_model_id)
@@ -1798,7 +1798,7 @@ def test_sdv1_5_lcm_lora_img2img(self):
17981798
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/img2img/fantasy_landscape.png"
17991799
)
18001800

1801-
generator = torch.Generator().manual_seed(0)
1801+
generator = torch.Generator("cpu").manual_seed(0)
18021802

18031803
lora_model_id = "latent-consistency/lcm-lora-sdv1-5"
18041804
pipe.load_lora_weights(lora_model_id)
@@ -1866,15 +1866,13 @@ def test_sdxl_1_0_lora_unfusion(self):
18661866
images = pipe(
18671867
"masterpiece, best quality, mountain", output_type="pil", generator=generator, num_inference_steps=3
18681868
).images
1869-
images[0].save("fused.png")
18701869
images_with_fusion = images.flatten()
18711870

18721871
pipe.unfuse_lora()
18731872
generator = torch.Generator("cpu").manual_seed(0)
18741873
images = pipe(
18751874
"masterpiece, best quality, mountain", output_type="pil", generator=generator, num_inference_steps=3
18761875
).images
1877-
images[0].save("unfused.png")
18781876
images_without_fusion = images.flatten()
18791877

18801878
self.assertTrue(np.allclose(images_with_fusion, images_without_fusion, atol=1e-3))

0 commit comments

Comments
 (0)