Skip to content

Commit

Permalink
[XPU] adapt lazy_call func to different versions (#5670)
Browse files Browse the repository at this point in the history
Previously, lay_call function was wrapped by
torch.xpu.lay_init._lazy_call, which is now changed to
torch.xpu._lazy_call.

Thus we change this function to adapt different versions.
  • Loading branch information
YizhouZ authored Jun 17, 2024
1 parent 05cb79d commit 7331630
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion accelerator/xpu_accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ def range_pop(self):
return

def lazy_call(self, callback):
return torch.xpu.lazy_init._lazy_call(callback)
if hasattr(torch.xpu, "_lazy_call"):
return torch.xpu._lazy_call(callback)
else:
return torch.xpu.lazy_init._lazy_call(callback)

def communication_backend_name(self):
return self._communication_backend_name
Expand Down

0 comments on commit 7331630

Please sign in to comment.