mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
deallocate images on batch
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user