Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion tests/pipelines/amused/test_amused_inpaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from diffusers import AmusedInpaintPipeline, AmusedScheduler, UVit2DModel, VQModel
from diffusers.utils import load_image
from diffusers.utils.testing_utils import (
Expectations,
enable_full_determinism,
require_torch_accelerator,
slow,
Expand Down Expand Up @@ -246,5 +247,35 @@ def test_amused_512_fp16(self):
image_slice = image[0, -3:, -3:, -1].flatten()

assert image.shape == (1, 512, 512, 3)
expected_slice = np.array([0.0227, 0.0157, 0.0098, 0.0213, 0.0250, 0.0127, 0.0280, 0.0380, 0.0095])
expected_slices = Expectations(
{
("xpu", 3): np.array(
[
0.0274,
0.0211,
0.0154,
0.0257,
0.0299,
0.0170,
0.0326,
0.0420,
0.0150,
]
),
("cuda", 7): np.array(
[
0.0227,
0.0157,
0.0098,
0.0213,
0.0250,
0.0127,
0.0280,
0.0380,
0.0095,
]
),
}
)
expected_slice = expected_slices.get_expectation()
assert np.abs(image_slice - expected_slice).max() < 0.003
2 changes: 1 addition & 1 deletion tests/pipelines/test_pipelines_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ def test_float16_inference(self, expected_max_diff=5e-2):

output_fp16 = pipe_fp16(**fp16_inputs)[0]
max_diff = numpy_cosine_similarity_distance(output.flatten(), output_fp16.flatten())
assert max_diff < 2e-4
assert max_diff < 1e-2

@unittest.skipIf(torch_device not in ["cuda", "xpu"], reason="float16 requires CUDA or XPU")
@require_accelerator
Expand Down