diff --git a/tests/pipelines/amused/test_amused_inpaint.py b/tests/pipelines/amused/test_amused_inpaint.py index 62f39de8c355..0b025b8a3f83 100644 --- a/tests/pipelines/amused/test_amused_inpaint.py +++ b/tests/pipelines/amused/test_amused_inpaint.py @@ -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, @@ -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 diff --git a/tests/pipelines/test_pipelines_common.py b/tests/pipelines/test_pipelines_common.py index 4a3a9b1796a1..69dd79bb5627 100644 --- a/tests/pipelines/test_pipelines_common.py +++ b/tests/pipelines/test_pipelines_common.py @@ -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