1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

make test_stable_diffusion_inpaint_fp16 pass on XPU (#11264)

Signed-off-by: Matrix Yao <matrix.yao@intel.com>
This commit is contained in:
Yao Matrix
2025-04-10 12:55:54 +08:00
committed by GitHub
parent 68663f8a17
commit 77b4f66b9e

View File

@@ -37,6 +37,7 @@ from diffusers import (
UNet2DConditionModel,
)
from diffusers.utils.testing_utils import (
Expectations,
backend_empty_cache,
backend_max_memory_allocated,
backend_reset_max_memory_allocated,
@@ -866,7 +867,37 @@ class StableDiffusionInpaintPipelineAsymmetricAutoencoderKLSlowTests(unittest.Te
image_slice = image[0, 253:256, 253:256, -1].flatten()
assert image.shape == (1, 512, 512, 3)
expected_slice = np.array([0.1343, 0.1406, 0.1440, 0.1504, 0.1729, 0.0989, 0.1807, 0.2822, 0.1179])
expected_slices = Expectations(
{
("xpu", 3): np.array(
[
0.2063,
0.1731,
0.1553,
0.1741,
0.1772,
0.1077,
0.2109,
0.2407,
0.1243,
]
),
("cuda", 7): np.array(
[
0.1343,
0.1406,
0.1440,
0.1504,
0.1729,
0.0989,
0.1807,
0.2822,
0.1179,
]
),
}
)
expected_slice = expected_slices.get_expectation()
assert np.abs(expected_slice - image_slice).max() < 5e-2