mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-10-05 14:25:43 +08:00
[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:
@@ -78,6 +78,8 @@ def _get_visible_devices_env() -> str | None:
|
||||
return "CUDA_VISIBLE_DEVICES"
|
||||
elif CURRENT_DEVICE == "npu":
|
||||
return "ASCEND_RT_VISIBLE_DEVICES"
|
||||
elif CURRENT_DEVICE == "xpu":
|
||||
return "ZE_AFFINITY_MASK"
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -160,6 +162,8 @@ def _manage_distributed_env(request: FixtureRequest, monkeypatch: MonkeyPatch) -
|
||||
monkeypatch.setattr(torch.cuda, "device_count", lambda: 1)
|
||||
elif CURRENT_DEVICE == "npu":
|
||||
monkeypatch.setattr(torch.npu, "device_count", lambda: 1)
|
||||
elif CURRENT_DEVICE == "xpu":
|
||||
monkeypatch.setattr(torch.xpu, "device_count", lambda: 1)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user