enable internvl UTs on XPU (#37779)

* enable internvl UTs on XPU

Signed-off-by: YAO Matrix <matrix.yao@intel.com>

* fix style

Signed-off-by: YAO Matrix <matrix.yao@intel.com>

* fix style per comments

Signed-off-by: Yao Matrix <matrix.yao@intel.com>

---------

Signed-off-by: YAO Matrix <matrix.yao@intel.com>
Signed-off-by: Yao Matrix <matrix.yao@intel.com>
This commit is contained in:
Yao Matrix
2025-04-30 16:29:40 +08:00
committed by GitHub
parent a57274466f
commit 34f26e2c3e
2 changed files with 95 additions and 20 deletions

View File

@@ -80,7 +80,6 @@ from transformers.testing_utils import (
require_bitsandbytes,
require_deepspeed,
require_flash_attn,
require_non_xpu,
require_safetensors,
require_torch,
require_torch_accelerator,
@@ -2604,7 +2603,7 @@ class ModelTesterMixin:
)[0]
torch.testing.assert_close(out_embeds, out_ids)
@require_non_xpu
@require_torch_gpu
@require_torch_multi_gpu
def test_multi_gpu_data_parallel_forward(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
@@ -3874,7 +3873,6 @@ class ModelTesterMixin:
with sdpa_kernel(enable_flash=True, enable_math=False, enable_mem_efficient=False):
_ = model(**inputs_dict)
@require_non_xpu
@require_torch_sdpa
@require_torch_accelerator
@slow
@@ -3887,8 +3885,8 @@ class ModelTesterMixin:
self.skipTest(reason="This test requires an NVIDIA GPU with compute capability >= 8.0")
elif device_type == "rocm" and major < 9:
self.skipTest(reason="This test requires an AMD GPU with compute capability >= 9.0")
else:
self.skipTest(reason="This test requires a Nvidia or AMD GPU")
elif device_type not in ["cuda", "rocm", "xpu"]:
self.skipTest(reason="This test requires a Nvidia or AMD GPU, or an Intel XPU")
torch.compiler.reset()