From 8a6e5617baa2b70bea0254683a4fb8f0759a7a06 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 13 Dec 2024 22:05:13 +0300 Subject: [PATCH] Fix IPEX 2.5 --- modules/intel/ipex/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/intel/ipex/__init__.py b/modules/intel/ipex/__init__.py index e1c476e7e..147aa2798 100644 --- a/modules/intel/ipex/__init__.py +++ b/modules/intel/ipex/__init__.py @@ -77,7 +77,7 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.warnings = torch.xpu.warnings torch.cuda.classproperty = torch.xpu.classproperty torch.UntypedStorage.cuda = torch.UntypedStorage.xpu - if not ipex.__version__.startswith("2.3"): + if float(ipex.__version__[:3]) < 2.3: torch.cuda._initialization_lock = torch.xpu.lazy_init._initialization_lock torch.cuda._initialized = torch.xpu.lazy_init._initialized torch.cuda._is_in_bad_fork = torch.xpu.lazy_init._is_in_bad_fork @@ -111,7 +111,7 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.ComplexFloatStorage = torch.xpu.ComplexFloatStorage torch.cuda.ComplexDoubleStorage = torch.xpu.ComplexDoubleStorage - if not legacy or ipex.__version__.startswith("2.3"): + if not legacy or float(ipex.__version__[:3]) >= 2.3: torch.cuda._initialization_lock = torch.xpu._initialization_lock torch.cuda._initialized = torch.xpu._initialized torch.cuda._is_in_bad_fork = torch.xpu._is_in_bad_fork @@ -159,7 +159,7 @@ def ipex_init(): # pylint: disable=too-many-statements torch.xpu.amp.custom_fwd = torch.cuda.amp.custom_fwd torch.xpu.amp.custom_bwd = torch.cuda.amp.custom_bwd torch.cuda.amp = torch.xpu.amp - if not ipex.__version__.startswith("2.3"): + if float(ipex.__version__[:3]) < 2.3: torch.is_autocast_enabled = torch.xpu.is_autocast_xpu_enabled torch.get_autocast_gpu_dtype = torch.xpu.get_autocast_xpu_dtype @@ -178,7 +178,7 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.amp.GradScaler = ipex.cpu.autocast._grad_scaler.GradScaler # C - if legacy and not ipex.__version__.startswith("2.3"): + if legacy and float(ipex.__version__[:3]) < 2.3: torch._C._cuda_getCurrentRawStream = ipex._C._getCurrentRawStream ipex._C._DeviceProperties.multi_processor_count = ipex._C._DeviceProperties.gpu_subslice_count ipex._C._DeviceProperties.major = 12