From c3a4293f2227fe77b9ea908c99a1bda2aef43175 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Wed, 12 Jul 2023 13:02:42 +0300 Subject: [PATCH] Disable torch_gc for IPEX in WSL2 --- modules/devices.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/devices.py b/modules/devices.py index 90cd05f6f..8dd32a964 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -1,3 +1,4 @@ +import os import gc import sys import contextlib @@ -79,7 +80,7 @@ def torch_gc(force=False): if shared.opts.disable_gc and not force: return collected = gc.collect() - if backend == 'ipex': + if backend == 'ipex' and "WSL2" not in os.popen("uname -a").read(): try: with torch.xpu.device(get_cuda_device_string()): torch.xpu.empty_cache()