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

make test_instant_style_multiple_masks pass on XPU (#11266)

Signed-off-by: Matrix Yao <matrix.yao@intel.com>
This commit is contained in:
Yao Matrix
2025-04-10 13:23:00 +08:00
committed by GitHub
parent 0efdf411fb
commit 31c4f24fc1

View File

@@ -34,6 +34,7 @@ from diffusers import (
from diffusers.image_processor import IPAdapterMaskProcessor
from diffusers.utils import load_image
from diffusers.utils.testing_utils import (
Expectations,
backend_empty_cache,
enable_full_determinism,
is_flaky,
@@ -664,7 +665,50 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
images = pipeline(**inputs).images
image_slice = images[0, :3, :3, -1].flatten()
expected_slice = np.array([0.2323, 0.1026, 0.1338, 0.0638, 0.0662, 0.0000, 0.0000, 0.0000, 0.0199])
expected_slices = Expectations(
{
("xpu", 3): np.array(
[
0.2520,
0.1050,
0.1510,
0.0997,
0.0893,
0.0019,
0.0000,
0.0000,
0.0210,
]
),
("cuda", 7): np.array(
[
0.2323,
0.1026,
0.1338,
0.0638,
0.0662,
0.0000,
0.0000,
0.0000,
0.0199,
]
),
("cuda", 8): np.array(
[
0.2518,
0.1059,
0.1553,
0.0977,
0.0852,
0.0000,
0.0000,
0.0000,
0.0220,
]
),
}
)
expected_slice = expected_slices.get_expectation()
max_diff = numpy_cosine_similarity_distance(image_slice, expected_slice)
assert max_diff < 5e-4