mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
handle sending of deleted images
This commit is contained in:
+1
-1
@@ -308,7 +308,7 @@
|
||||
{"id":"","label":"ipex","localized":"","hint":""},
|
||||
{"id":"","label":"Model compile verbose mode","localized":"","hint":""},
|
||||
{"id":"","label":"Model compile suppress errors","localized":"","hint":""},
|
||||
{"id":"","label":"Disable Torch memory garbage collection (experimental)","localized":"","hint":""},
|
||||
{"id":"","label":"Disable Torch memory garbage collection","localized":"","hint":""},
|
||||
{"id":"","label":"Directory for temporary images; leave empty for default","localized":"","hint":""},
|
||||
{"id":"","label":"Cleanup non-default temporary directory when starting webui","localized":"","hint":""},
|
||||
{"id":"","label":"Path to directory with stable diffusion checkpoints","localized":"","hint":""},
|
||||
|
||||
@@ -59,6 +59,11 @@ def image_from_url_text(filedata):
|
||||
is_in_right_dir = ui_tempdir.check_tmp_file(shared.demo, filename)
|
||||
if is_in_right_dir:
|
||||
filename = filename.rsplit('?', 1)[0]
|
||||
if not os.path.exists(filename):
|
||||
shared.log.error(f'Image file not found: {filename}')
|
||||
image = Image.new('RGB', (512, 512))
|
||||
image.info['parameters'] = f'Image file not found: {filename}'
|
||||
return image
|
||||
image = Image.open(filename)
|
||||
geninfo, _items = images.read_info_from_image(image)
|
||||
image.info['parameters'] = geninfo
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
from types import MethodType
|
||||
import torch
|
||||
from torch.nn.functional import silu
|
||||
|
||||
@@ -541,7 +541,6 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None, timer=None)
|
||||
sd_hijack.model_hijack.undo_hijack(model_data.sd_model)
|
||||
current_checkpoint_info = model_data.sd_model.sd_checkpoint_info
|
||||
unload_model_weights()
|
||||
model_data.sd_model = None
|
||||
do_inpainting_hijack()
|
||||
devices.set_cuda_params()
|
||||
if already_loaded_state_dict is not None:
|
||||
@@ -668,8 +667,16 @@ def unload_model_weights(sd_model=None, _info=None):
|
||||
model_data.sd_model.to(devices.cpu)
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
sd_hijack.model_hijack.undo_hijack(model_data.sd_model)
|
||||
model_data.sd_model = None
|
||||
sd_model = None
|
||||
"""
|
||||
if hasattr(model_data.sd_model, 'model'):
|
||||
del model_data.sd_model.model
|
||||
if hasattr(model_data.sd_model, 'first_stage_model'):
|
||||
del model_data.sd_model.first_stage_model
|
||||
if hasattr(model_data.sd_model, 'cond_stage_model'):
|
||||
del model_data.sd_model.cond_stage_model
|
||||
"""
|
||||
model_data.sd_model = None
|
||||
devices.torch_gc(force=True)
|
||||
shared.log.debug(f'Model weights unloaded: {memory_stats()}')
|
||||
return sd_model
|
||||
|
||||
+1
-1
@@ -331,7 +331,7 @@ options_templates.update(options_section(('cuda', "Compute Settings"), {
|
||||
"cuda_compile_mode": OptionInfo("none", "Model compile mode (experimental)", gr.Radio, lambda: {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'ipex']}),
|
||||
"cuda_compile_verbose": OptionInfo(False, "Model compile verbose mode"),
|
||||
"cuda_compile_errors": OptionInfo(True, "Model compile suppress errors"),
|
||||
"disable_gc": OptionInfo(False, "Disable Torch memory garbage collection (experimental)"),
|
||||
"disable_gc": OptionInfo(False, "Disable Torch memory garbage collection"),
|
||||
}))
|
||||
|
||||
options_templates.update(options_section(('system-paths', "System Paths"), {
|
||||
|
||||
Reference in New Issue
Block a user