deallocate images on batch

This commit is contained in:
Vladimir Mandic
2023-08-12 07:18:19 +00:00
parent 605988f520
commit fc8eca1c34
3 changed files with 3 additions and 0 deletions
+1
View File
@@ -477,6 +477,7 @@ def atomically_save_image():
image.save(fn, format=image_format, quality=shared.opts.jpeg_quality)
except Exception as e:
shared.log.warning(f'Image save failed: {fn} {e}')
image.close()
# additional metadata saved in files
if shared.opts.save_txt and len(exifinfo) > 0:
try:
+1
View File
@@ -76,6 +76,7 @@ def run_postprocessing(extras_mode, image, image_folder: List[tempfile.NamedTemp
images.save_image(pp.image, path=outpath, basename=basename, seed=None, prompt=None, extension=ext or opts.samples_format, info=infotext, short_filename=True, no_prompt=True, grid=False, pnginfo_section_name="extras", existing_info=pp.image.info, forced_filename=None)
if extras_mode != 2 or show_extras_results:
outputs.append(pp.image)
image.close()
devices.torch_gc()
return outputs, infotext, params
+1
View File
@@ -17,6 +17,7 @@ local_url = None
errors.log.debug('Loading Torch')
import torch # pylint: disable=C0411
errors.log.debug(f'Torch init: {torch.sum(torch.randn(2, 2)).to(0) > 0}') # fix silly pytorch_lightning issue
try:
import intel_extension_for_pytorch as ipex # pylint: disable=import-error, unused-import
except Exception: