Unverified Commit 77b4f66b authored by Yao Matrix's avatar Yao Matrix Committed by GitHub
Browse files

make test_stable_diffusion_inpaint_fp16 pass on XPU (#11264)


Signed-off-by: default avatarMatrix Yao <matrix.yao@intel.com>
parent 68663f8a
...@@ -37,6 +37,7 @@ from diffusers import ( ...@@ -37,6 +37,7 @@ from diffusers import (
UNet2DConditionModel, UNet2DConditionModel,
) )
from diffusers.utils.testing_utils import ( from diffusers.utils.testing_utils import (
Expectations,
backend_empty_cache, backend_empty_cache,
backend_max_memory_allocated, backend_max_memory_allocated,
backend_reset_max_memory_allocated, backend_reset_max_memory_allocated,
...@@ -866,7 +867,37 @@ class StableDiffusionInpaintPipelineAsymmetricAutoencoderKLSlowTests(unittest.Te ...@@ -866,7 +867,37 @@ class StableDiffusionInpaintPipelineAsymmetricAutoencoderKLSlowTests(unittest.Te
image_slice = image[0, 253:256, 253:256, -1].flatten() image_slice = image[0, 253:256, 253:256, -1].flatten()
assert image.shape == (1, 512, 512, 3) 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 assert np.abs(expected_slice - image_slice).max() < 5e-2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment