From 9fee00f4b9d3f0c952a884af2b432fec06f33ea5 Mon Sep 17 00:00:00 2001 From: "Liu, Kaixuan" Date: Mon, 11 May 2026 08:37:19 +0000 Subject: [PATCH 1/3] exaone4_5: add XPU expectations Signed-off-by: Liu, Kaixuan --- .../models/exaone4_5/test_modeling_exaone4_5.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/models/exaone4_5/test_modeling_exaone4_5.py b/tests/models/exaone4_5/test_modeling_exaone4_5.py index e3de6c204fa4..749d524f4afe 100644 --- a/tests/models/exaone4_5/test_modeling_exaone4_5.py +++ b/tests/models/exaone4_5/test_modeling_exaone4_5.py @@ -23,6 +23,7 @@ from transformers.testing_utils import ( Expectations, cleanup, + require_deterministic_for_xpu, require_torch, slow, torch_device, @@ -164,6 +165,7 @@ def setUpClass(cls): def tearDown(self): cleanup(torch_device, gc_collect=True) + @require_deterministic_for_xpu @slow def test_model_logits(self): input_ids = [70045, 1109, 115406, 16943, 11697, 115365, 19816, 12137, 375] @@ -177,6 +179,9 @@ def test_model_logits(self): ("cuda", (8, 6)): torch.tensor( [[44.8527, 45.7216, 71.1159, 36.9564, 44.3283, 22.0527, 28.3233, 62.5739, 46.0708]] ), + ("xpu", None): torch.tensor( + [[45.2173, 45.4939, 71.0896, 37.1218, 44.3504, 22.1194, 28.6795, 62.5956, 45.9839]] + ), } ) EXPECTED_SLICE = Expectations( @@ -184,12 +189,16 @@ def test_model_logits(self): ("cuda", (8, 6)): torch.tensor( [42.2500, 43.0000, 42.5000, 44.7500, 49.5000, 46.0000, 46.5000, 46.5000, 45.7500, 46.2500] ), + ("xpu", None): torch.tensor( + [42.7500, 43.5000, 42.7500, 45.2500, 50.0000, 46.5000, 46.7500, 46.7500, 46.0000, 46.5000] + ), } ) torch.testing.assert_close(out.mean(-1), EXPECTED_MEAN.get_expectation(), atol=1e-2, rtol=1e-2) torch.testing.assert_close(out[0, 0, :10], EXPECTED_SLICE.get_expectation(), atol=1e-4, rtol=1e-4) + @require_deterministic_for_xpu @slow def test_model_generation_text_only(self): EXPECTED_TEXT = Expectations( @@ -198,6 +207,10 @@ def test_model_generation_text_only(self): '\nTell me about the Miracle on the Han river.\n\n\n\n\n\nThe **"Miracle on the Han River"**' " is a term used to describe the rapid economic development and industrialization that South Korea experienced" ), + ("xpu", None): ( + '\nTell me about the Miracle on the Han river.\n\n\n\n\n\nThe **"Miracle on the Han River"**' + " is a term used to describe the rapid economic development and industrialization that South Korea experienced" + ), } ) messages = [ @@ -215,6 +228,7 @@ def test_model_generation_text_only(self): text = self.processor.decode(generated_ids[0], skip_special_tokens=True) self.assertEqual(text, EXPECTED_TEXT.get_expectation()) + @require_deterministic_for_xpu @slow def test_model_generation_image_text(self): IMAGE_URL = ( @@ -225,6 +239,9 @@ def test_model_generation_image_text(self): ("cuda", 8): ( "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a fluffy, young lynx kitten walking across a snowy surface, its thick" ), + ("xpu", None): ( + "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a young, fluffy wild cat\u2014likely a lynx kitten\u2014walking through a" + ), } ) messages = [ From 9b915a67e17dd93eb3692c8984af63e2e5eb0abd Mon Sep 17 00:00:00 2001 From: kaixuanliu Date: Mon, 11 May 2026 17:17:53 +0800 Subject: [PATCH 2/3] Update test_modeling_exaone4_5.py --- tests/models/exaone4_5/test_modeling_exaone4_5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/models/exaone4_5/test_modeling_exaone4_5.py b/tests/models/exaone4_5/test_modeling_exaone4_5.py index 749d524f4afe..86fc754c23c8 100644 --- a/tests/models/exaone4_5/test_modeling_exaone4_5.py +++ b/tests/models/exaone4_5/test_modeling_exaone4_5.py @@ -240,7 +240,7 @@ def test_model_generation_image_text(self): "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a fluffy, young lynx kitten walking across a snowy surface, its thick" ), ("xpu", None): ( - "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a young, fluffy wild cat\u2014likely a lynx kitten\u2014walking through a" + "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a young, fluffy wild cat-likely a lynx kitten-walking through a" ), } ) From 5ba752fbf4230b2f99e9dad2585840e9c06994c5 Mon Sep 17 00:00:00 2001 From: "Liu, Kaixuan" Date: Mon, 11 May 2026 09:27:30 +0000 Subject: [PATCH 3/3] update Signed-off-by: Liu, Kaixuan --- tests/models/exaone4_5/test_modeling_exaone4_5.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/models/exaone4_5/test_modeling_exaone4_5.py b/tests/models/exaone4_5/test_modeling_exaone4_5.py index 86fc754c23c8..22790ed116be 100644 --- a/tests/models/exaone4_5/test_modeling_exaone4_5.py +++ b/tests/models/exaone4_5/test_modeling_exaone4_5.py @@ -239,8 +239,8 @@ def test_model_generation_image_text(self): ("cuda", 8): ( "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a fluffy, young lynx kitten walking across a snowy surface, its thick" ), - ("xpu", None): ( - "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a young, fluffy wild cat-likely a lynx kitten-walking through a" + ("xpu", 3): ( + "\n\nDescribe the image.\n\n\n\n\n\nThe image captures a young, fluffy wild cat—likely a lynx kitten—walking through a" ), } )