Skip to content

Commit 42c7e36

Browse files
committed
fix tests
1 parent 7ed8eab commit 42c7e36

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_adapter.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,29 @@ def test_inference_batch_single_identical(
591591
if test_mean_pixel_difference:
592592
assert_mean_pixel_difference(output_batch[0][0], output[0][0])
593593

594+
def test_adapter_sdxl_lcm(self):
595+
device = "cpu" # ensure determinism for the device-dependent torch.Generator
596+
597+
components = self.get_dummy_components(time_cond_proj_dim=256)
598+
sd_pipe = StableDiffusionXLAdapterPipeline(**components)
599+
sd_pipe.scheduler = LCMScheduler.from_config(sd_pipe.scheduler.config)
600+
sd_pipe = sd_pipe.to(torch_device)
601+
sd_pipe.set_progress_bar_config(disable=None)
602+
603+
inputs = self.get_dummy_inputs(device)
604+
output = sd_pipe(**inputs)
605+
image = output.images
606+
607+
image_slice = image[0, -3:, -3:, -1]
608+
609+
assert image.shape == (1, 64, 64, 3)
610+
expected_slice = np.array([0.5313, 0.5375, 0.4942, 0.5021, 0.6142, 0.4968, 0.5434, 0.5311, 0.5448])
611+
612+
debug = [str(round(i, 4)) for i in image_slice.flatten().tolist()]
613+
print(",".join(debug))
614+
615+
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
616+
594617

595618
@slow
596619
@require_torch_gpu

0 commit comments

Comments
 (0)