From 737cbd2109f3bfc2c6fb14d5f373b7e0eb2d7646 Mon Sep 17 00:00:00 2001 From: jiqing-feng Date: Tue, 1 Apr 2025 17:10:13 +0800 Subject: [PATCH] Fix llava xpu tests. (#37130) * fix llava 4bit xpu test Signed-off-by: jiqing-feng * fix llava 4bit xpu test Signed-off-by: jiqing-feng * fix format Signed-off-by: jiqing-feng * fix format Signed-off-by: jiqing-feng --------- Signed-off-by: jiqing-feng --- tests/models/llava/test_modeling_llava.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/models/llava/test_modeling_llava.py b/tests/models/llava/test_modeling_llava.py index cc042e9f66..23f9f1a7d0 100644 --- a/tests/models/llava/test_modeling_llava.py +++ b/tests/models/llava/test_modeling_llava.py @@ -617,8 +617,13 @@ These descriptions provide a detailed overview of the content and atmosphere of generate_ids = model.generate(**inputs, max_new_tokens=50) output = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0] - EXPECTED_GENERATION = "Describe the images. The image showcases a dog, which is prominently positioned in the center, taking up a significant portion of the frame. The dog is situated against a backdrop of a wooden surface, which spans the entire image. The dog appears to be a black Labrador" # fmt: skip - self.assertEqual(output, EXPECTED_GENERATION) + EXPECTED_GENERATION = [ + # CUDA output + "Describe the images. The image showcases a dog, which is prominently positioned in the center, taking up a significant portion of the frame. The dog is situated against a backdrop of a wooden surface, which spans the entire image. The dog appears to be a black Labrador", + # XPU output + "Describe the images.The image showcases a dog, which is prominently positioned in the center, taking up a significant portion of the frame. The dog is situated against a backdrop of a wooden surface, which covers the entire background. The dog appears to be the main focus", + ] # fmt: skip + self.assertTrue(output in EXPECTED_GENERATION) @slow @require_bitsandbytes