add xpu device check in device_placement (#35865)

add xpu device
This commit is contained in:
Fanli Lin 2025-01-25 02:13:07 +08:00 committed by GitHub
parent b912f5ee43
commit bcb841f007
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1148,6 +1148,9 @@ class Pipeline(_ScikitCompat, PushToHubMixin):
elif self.device.type == "musa":
with torch.musa.device(self.device):
yield
elif self.device.type == "xpu":
with torch.xpu.device(self.device):
yield
else:
yield