Skip to content

Commit

Permalink
Merge pull request #12515 from catboxanon/fix/gc1
Browse files Browse the repository at this point in the history
Clear sampler and garbage collect before decoding images to reduce VRAM
  • Loading branch information
AUTOMATIC1111 authored Aug 13, 2023
2 parents 127ab91 + 69f49c8 commit d73db17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,9 @@ def save_intermediate(image, index):

sd_models.apply_token_merging(self.sd_model, self.get_token_merging_ratio())

self.sampler = None
devices.torch_gc()

decoded_samples = decode_latent_batch(self.sd_model, samples, target_device=devices.cpu, check_for_nans=True)

self.is_hr_pass = False
Expand Down

0 comments on commit d73db17

Please sign in to comment.