mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
Add torch.xpu.empty_cache() to LDSR and SwinIR
This commit is contained in:
@@ -113,6 +113,8 @@ class LDSR:
|
||||
gc.collect()
|
||||
if torch.cuda.is_available:
|
||||
torch.cuda.empty_cache()
|
||||
if shared.cmd_opts.use_ipex:
|
||||
torch.xpu.empty_cache()
|
||||
|
||||
im_og = image
|
||||
width_og, height_og = im_og.size
|
||||
|
||||
@@ -7,7 +7,7 @@ from tqdm.rich import tqdm
|
||||
from swinir_model_arch import SwinIR as net
|
||||
from swinir_model_arch_v2 import Swin2SR as net2
|
||||
from modules import modelloader, devices, script_callbacks, shared
|
||||
from modules.shared import opts, state
|
||||
from modules.shared import cmd_opts, opts, state
|
||||
from modules.upscaler import Upscaler, UpscalerData
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ class UpscalerSwinIR(Upscaler):
|
||||
torch.cuda.empty_cache()
|
||||
except Exception:
|
||||
pass
|
||||
if cmd_opts.use_ipex:
|
||||
torch.xpu.empty_cache()
|
||||
return img
|
||||
|
||||
def load_model(self, path, scale=4):
|
||||
|
||||
Reference in New Issue
Block a user