Replace empty_cache with torch_gc

This commit is contained in:
Disty0
2023-07-12 12:45:21 +03:00
parent 562ca33275
commit 2bce86a50a
5 changed files with 7 additions and 20 deletions
+1 -4
View File
@@ -101,10 +101,7 @@ def setup_model(dirname):
output = self.net(cropped_face_t, w=w if w is not None else shared.opts.code_former_weight, adain=True)[0]
restored_face = tensor2img(output, rgb2bgr=True, min_max=(-1, 1))
del output
if devices.backend == 'ipex':
torch.xpu.empty_cache()
else:
torch.cuda.empty_cache()
devices.torch_gc()
except Exception as error:
print(f'\tFailed inference for CodeFormer: {error}', file=sys.stderr)
restored_face = tensor2img(cropped_face_t, rgb2bgr=True, min_max=(-1, 1))