From fbc550d02e52c542358f1ed3370684c9dc9b8c5f Mon Sep 17 00:00:00 2001 From: Max Lansing Date: Sun, 20 Aug 2023 19:04:16 -0700 Subject: [PATCH] fix: VRAM memory leak in sdxl_gen_img.py --- sdxl_gen_img.py | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 sdxl_gen_img.py diff --git a/sdxl_gen_img.py b/sdxl_gen_img.py old mode 100644 new mode 100755 index cb16a781..20ee3c62 --- a/sdxl_gen_img.py +++ b/sdxl_gen_img.py @@ -754,6 +754,9 @@ class PipelineLike: # we always cast to float32 as this does not cause significant overhead and is compatible with bfloa16 image = image.cpu().permute(0, 2, 3, 1).float().numpy() + if torch.cuda.is_available(): + torch.cuda.empty_cache() + if output_type == "pil": # image = self.numpy_to_pil(image) image = (image * 255).round().astype("uint8")