Disable torch_gc for IPEX in WSL2

This commit is contained in:
Disty0
2023-07-12 13:02:42 +03:00
parent 2bce86a50a
commit c3a4293f22
+2 -1
View File
@@ -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()