diff options
author | Jacob Tyndall <jacob.n.tyndall@gmail.com> | 2022-09-24 01:18:34 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-09-24 04:41:59 +0000 |
commit | 0f77e1852ffa583a477edce7f7eabfb6aa6d5ec1 (patch) | |
tree | ee510376a1f636a33a3c3185ab447fde0362743f /modules | |
parent | 74f940e8183e0745029ee38e7542237205c927d8 (diff) | |
download | stable-diffusion-webui-gfx803-0f77e1852ffa583a477edce7f7eabfb6aa6d5ec1.tar.gz stable-diffusion-webui-gfx803-0f77e1852ffa583a477edce7f7eabfb6aa6d5ec1.tar.bz2 stable-diffusion-webui-gfx803-0f77e1852ffa583a477edce7f7eabfb6aa6d5ec1.zip |
Clear no longer needed VRAM during a 'highres fix' generation created during the first sampling before doing the second (img2img) sampling. Makes it possible to use the feature on an 8GB card.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/processing.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/processing.py b/modules/processing.py index 79a159a2..0246e094 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -488,6 +488,11 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): self.sampler = samplers[self.sampler_index].constructor(self.sd_model)
noise = create_random_tensors(samples.shape[1:], seeds=seeds, subseeds=subseeds, subseed_strength=subseed_strength, seed_resize_from_h=self.seed_resize_from_h, seed_resize_from_w=self.seed_resize_from_w, p=self)
+
+ # GC now before running the next img2img to prevent running out of memory
+ x = None
+ devices.torch_gc()
+
samples = self.sampler.sample_img2img(self, samples, noise, conditioning, unconditional_conditioning, steps=self.steps)
return samples
|