[xpu] add Intel XPU support to test infrastructure and runs_on markers (#10835)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
shubham singhal
2026-09-28 09:17:33 +05:30
committed by GitHub
parent 97b32d3133
commit d4823eb10e
21 changed files with 114 additions and 106 deletions

View File

@@ -32,7 +32,7 @@ from llamafactory.model import load_tokenizer
TINY_LLAMA3 = os.getenv("TINY_LLAMA3", "llamafactory/tiny-random-Llama-3")
@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_base_collator():
model_args, data_args, *_ = get_infer_args({"model_name_or_path": TINY_LLAMA3, "template": "default"})
tokenizer_module = load_tokenizer(model_args)
@@ -76,7 +76,7 @@ def test_base_collator():
assert batch_input[k].eq(torch.tensor(expected_input[k])).all()
@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_multimodal_collator():
model_args, data_args, *_ = get_infer_args(
{"model_name_or_path": "Qwen/Qwen2-VL-2B-Instruct", "template": "qwen2_vl"}
@@ -270,7 +270,7 @@ def _get_expected_position_ids(
return torch.cat(all_position_ids, dim=-1)
@pytest.mark.runs_on(["cpu", "mps"])
@pytest.mark.runs_on(["cpu", "mps", "xpu"])
def test_multimodal_collator_with_packing():
model_args, data_args, *_ = get_infer_args(
{"model_name_or_path": "Qwen/Qwen2-VL-2B-Instruct", "template": "qwen2_vl"}
@@ -322,7 +322,7 @@ def test_multimodal_collator_with_packing():
assert batch_input["position_ids"][1:, :, :valid_len].eq(expected_position_ids).all()
@pytest.mark.runs_on(["cpu"])
@pytest.mark.runs_on(["cpu", "xpu"])
def test_4d_attention_mask():
o = 0.0
x = torch.finfo(torch.float16).min