From 39b768564af34e94e2dfc3b9947b581cae50607d Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sun, 17 May 2026 18:26:19 +0300 Subject: [PATCH] update ipex and rocm to torch 2.12 --- installer.py | 6 +++--- modules/intel/ipex/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/installer.py b/installer.py index 147c76892..21341afaf 100644 --- a/installer.py +++ b/installer.py @@ -668,9 +668,9 @@ def install_rocm_zluda(): torch_command = os.environ.get('TORCH_COMMAND', '--upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/rocm7.1') else: if rocm.version is None or float(rocm.version) >= 7.2: # assume the latest if version check fails - torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.11.0+rocm7.2 torchvision==0.26.0+rocm7.2 --index-url https://download.pytorch.org/whl/rocm7.2') + torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.12.0+rocm7.2 torchvision==0.27.0+rocm7.2 --index-url https://download.pytorch.org/whl/rocm7.2') elif rocm.version == "7.1": - torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.11.0+rocm7.1 torchvision==0.26.0+rocm7.1 --index-url https://download.pytorch.org/whl/rocm7.1') + torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.12.0+rocm7.1 torchvision==0.27.0+rocm7.1 --index-url https://download.pytorch.org/whl/rocm7.1') elif rocm.version == "7.0": torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.10.0+rocm7.0 torchvision==0.25.0+rocm7.0 --index-url https://download.pytorch.org/whl/rocm7.0') elif rocm.version == "6.4": @@ -708,7 +708,7 @@ def install_ipex(): if args.use_nightly: torch_command = os.environ.get('TORCH_COMMAND', '--upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/xpu') else: - torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.11.0+xpu torchvision==0.26.0+xpu --index-url https://download.pytorch.org/whl/xpu') + torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.12.0+xpu torchvision==0.27.0+xpu --index-url https://download.pytorch.org/whl/xpu') ts('ipex', t_start) return torch_command diff --git a/modules/intel/ipex/__init__.py b/modules/intel/ipex/__init__.py index 523d19516..ebb594f33 100644 --- a/modules/intel/ipex/__init__.py +++ b/modules/intel/ipex/__init__.py @@ -67,7 +67,6 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.stream = torch.xpu.stream torch.cuda.Event = torch.xpu.Event torch.cuda.Stream = torch.xpu.Stream - torch.cuda.Optional = torch.xpu.Optional torch.cuda.streams = torch.xpu.streams torch.cuda.Any = torch.xpu.Any torch.cuda.default_generators = torch.xpu.default_generators @@ -165,6 +164,9 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda._device = torch.xpu._device torch.cuda._device_t = torch.xpu._device_t + if torch_version[0] < 2 or (torch_version[0] == 2 and torch_version[1] < 12): + torch.cuda.Optional = torch.xpu.Optional + # Memory: if "linux" in sys.platform and "WSL2" in os.popen("uname -a").read(): torch.xpu.empty_cache = return_none