fix: VRAM memory leak in sdxl_gen_img.py

This commit is contained in:
Max Lansing
2023-08-20 19:04:16 -07:00
parent 014c4b47c9
commit fbc550d02e

3
sdxl_gen_img.py Normal file → Executable file
View File

@@ -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")