IPEX fixes

This commit is contained in:
Disty0
2024-10-18 01:12:28 +03:00
parent 1a7b88ab64
commit 065155f5e6
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -199,7 +199,7 @@ def ipex_init(): # pylint: disable=too-many-statements
torch.cuda.ipc_collect = lambda *args, **kwargs: None
torch.cuda.utilization = lambda *args, **kwargs: 0
ipex_hijacks()
ipex_hijacks(legacy=legacy)
try:
from .diffusers import ipex_diffusers
ipex_diffusers()
+3 -2
View File
@@ -293,7 +293,9 @@ def torch_load(f, map_location=None, *args, **kwargs):
# Hijack Functions:
def ipex_hijacks():
def ipex_hijacks(legacy=True):
if legacy:
torch.nn.functional.interpolate = interpolate
torch.tensor = torch_tensor
torch.Tensor.to = Tensor_to
torch.Tensor.cuda = Tensor_cuda
@@ -319,7 +321,6 @@ def ipex_hijacks():
torch.nn.functional.layer_norm = functional_layer_norm
torch.nn.functional.linear = functional_linear
torch.nn.functional.conv2d = functional_conv2d
torch.nn.functional.interpolate = interpolate
torch.nn.functional.pad = functional_pad
torch.bmm = torch_bmm