From 042f5f9fed6caffab763130d70e5bd9920a7ef39 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sun, 22 Dec 2024 03:04:40 +0300 Subject: [PATCH] IPEX disable interpolate cpu fallback with IPEX 2.5 --- installer.py | 2 ++ modules/intel/ipex/hijacks.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/installer.py b/installer.py index 6aa8bb060..07917986f 100644 --- a/installer.py +++ b/installer.py @@ -637,6 +637,8 @@ def install_ipex(torch_command): os.environ.setdefault('NEOReadDebugKeys', '1') if os.environ.get("ClDeviceGlobalMemSizeAvailablePercent", None) is None: os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100') + if os.environ.get("PYTORCH_ENABLE_XPU_FALLBACK", None) is None: + os.environ.setdefault('PYTORCH_ENABLE_XPU_FALLBACK', '1') if "linux" in sys.platform: torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.5.1+cxx11.abi torchvision==0.20.1+cxx11.abi intel-extension-for-pytorch==2.5.10+xpu oneccl_bind_pt==2.5.0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/') # torch_command = os.environ.get('TORCH_COMMAND', 'torch torchvision --index-url https://download.pytorch.org/whl/test/xpu') # test wheels are stable previews, significantly slower than IPEX diff --git a/modules/intel/ipex/hijacks.py b/modules/intel/ipex/hijacks.py index 43721a64c..b1c9a1182 100644 --- a/modules/intel/ipex/hijacks.py +++ b/modules/intel/ipex/hijacks.py @@ -313,7 +313,7 @@ def torch_load(f, map_location=None, *args, **kwargs): # Hijack Functions: def ipex_hijacks(legacy=True): - if legacy: + if legacy and float(torch.__version__[:3]) < 2.5: torch.nn.functional.interpolate = interpolate torch.tensor = torch_tensor torch.Tensor.to = Tensor_to