From 47b9f06aa288a238890781b1a67f5e1624b38d43 Mon Sep 17 00:00:00 2001 From: Yao Matrix Date: Mon, 14 Apr 2025 17:39:45 +0800 Subject: [PATCH] make test_snowman_image_captioning pass on XPU, by sharing same atol w/ ROCM (#37480) Signed-off-by: YAO Matrix Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com> --- tests/models/kosmos2/test_modeling_kosmos2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/models/kosmos2/test_modeling_kosmos2.py b/tests/models/kosmos2/test_modeling_kosmos2.py index c37d695c06..102db8b57e 100644 --- a/tests/models/kosmos2/test_modeling_kosmos2.py +++ b/tests/models/kosmos2/test_modeling_kosmos2.py @@ -28,6 +28,7 @@ from transformers import AutoModelForImageTextToText, AutoProcessor, Kosmos2Conf from transformers.models.kosmos2.configuration_kosmos2 import Kosmos2TextConfig, Kosmos2VisionConfig from transformers.testing_utils import ( IS_ROCM_SYSTEM, + IS_XPU_SYSTEM, require_torch, require_vision, slow, @@ -655,7 +656,7 @@ class Kosmos2ModelIntegrationTest(unittest.TestCase): processed_text = processed_text[0] final_text, entities = final_text_with_entities[0] - atol = 1e-4 if IS_ROCM_SYSTEM else 1e-5 + atol = 1e-4 if (IS_ROCM_SYSTEM or IS_XPU_SYSTEM) else 1e-5 np.testing.assert_allclose( torch.concat(scores[1:4])[:3, :3].to("cpu").numpy(),