mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
@@ -1,6 +1,7 @@
|
||||
let lastState = {};
|
||||
let refreshInterval = 10000;
|
||||
const progressTimeout = 180;
|
||||
const startTimeout = 5;
|
||||
|
||||
function setRefreshInterval() {
|
||||
refreshInterval = opts.live_preview_refresh_period || 500;
|
||||
@@ -145,8 +146,18 @@ function requestProgress(id_task = 'undefined', progressEl = null, galleryEl = n
|
||||
lastState = res;
|
||||
const elapsedFromStart = (new Date() - dateStart) / 1000;
|
||||
hasStarted |= res.active;
|
||||
if (res.completed || (!res.active && (hasStarted || once)) || (elapsedFromStart > progressTimeout && !res.queued && res.progress === prevProgress)) {
|
||||
debug('progress', { end: res });
|
||||
if (res.completed || (!res.active && (hasStarted || once))) {
|
||||
debug('progress', { end: res, reason: res.completed ? 'completed' : 'inactive' });
|
||||
if (!res.paused) done(); // only abort if not paused
|
||||
return;
|
||||
}
|
||||
if (elapsedFromStart > progressTimeout && !res.queued && res.progress === prevProgress) {
|
||||
debug('progress', { end: res, reason: 'progressSimeout' });
|
||||
if (!res.paused) done(); // only abort if not paused
|
||||
return;
|
||||
}
|
||||
if (elapsedFromStart > startTimeout && !res.queued && !res.active) {
|
||||
debug('progress', { end: res, reason: 'startTimeout' });
|
||||
if (!res.paused) done(); // only abort if not paused
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class Options:
|
||||
return
|
||||
return super().__setattr__(key, value) # pylint: disable=super-with-arguments
|
||||
|
||||
def set(self, key, value):
|
||||
def set(self, key, value, force=False):
|
||||
"""sets an option and calls its onchange callback, returning True if the option changed and False otherwise"""
|
||||
if key in self.secrets:
|
||||
oldval = self.secrets.get(key, None)
|
||||
@@ -103,7 +103,7 @@ class Options:
|
||||
else:
|
||||
log.warning(f'Settings: key={key} value={value} unknown')
|
||||
return False
|
||||
if oldval == value:
|
||||
if oldval == value and not force:
|
||||
return False
|
||||
try:
|
||||
setattr(self, key, value)
|
||||
|
||||
@@ -160,10 +160,10 @@ def run_settings(*args):
|
||||
return shared.opts.dumpjson(), f'{len(changed)} Settings changed without save: {", ".join(changed)}'
|
||||
return shared.opts.dumpjson(), f'{len(changed)} Settings changed{": " if len(changed) > 0 else ""}{", ".join(changed)}'
|
||||
|
||||
def run_settings_single(value, key, progress=False):
|
||||
def run_settings_single(value, key, progress=False, force=False):
|
||||
if not shared.opts.same_type(value, shared.opts.data_labels[key].default):
|
||||
return gr.update(visible=True), shared.opts.dumpjson()
|
||||
if not shared.opts.set(key, value):
|
||||
if not shared.opts.set(key, value, force):
|
||||
return gr.update(value=getattr(shared.opts, key)), shared.opts.dumpjson()
|
||||
if key == "cuda_compile_backend" and value == "olive-ai":
|
||||
from modules.onnx_impl import install_olive
|
||||
@@ -171,9 +171,9 @@ def run_settings_single(value, key, progress=False):
|
||||
if shared.cmd_opts.use_directml:
|
||||
from modules.dml import directml_override_opts
|
||||
directml_override_opts()
|
||||
shared.opts.save()
|
||||
if key not in ['sd_model_checkpoint', 'sd_model_refiner', 'sd_vae', 'sd_te', 'sd_unet']:
|
||||
log.debug(f'Setting changed: {key}={value} progress={progress}')
|
||||
shared.opts.save(silent=True)
|
||||
if key not in ['sd_model_checkpoint', 'sd_model_refiner', 'sd_vae', 'sd_te', 'sd_unet'] or force:
|
||||
log.debug(f'Setting changed: {key}="{value}" progress={progress} force={force}')
|
||||
return get_value_for_setting(key), shared.opts.dumpjson()
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ def create_quicksettings(interfaces):
|
||||
|
||||
button_set_checkpoint = gr.Button('Change model', elem_id='change_checkpoint', visible=False)
|
||||
button_set_checkpoint.click(
|
||||
fn=lambda value, _: run_settings_single(value, key='sd_model_checkpoint'),
|
||||
fn=lambda value, _: run_settings_single(value, key='sd_model_checkpoint', force=True),
|
||||
_js="function(v){ var res = desiredCheckpointName; desiredCheckpointName = ''; return [res || v, null]; }",
|
||||
inputs=[shared.settings_components['sd_model_checkpoint'], dummy_component],
|
||||
outputs=[shared.settings_components['sd_model_checkpoint'], text_settings],
|
||||
|
||||
@@ -59,7 +59,7 @@ def warn_once(msg, variant=None):
|
||||
def get_model(model_cls, variant=None):
|
||||
if variant is not None:
|
||||
pass
|
||||
elif model_cls in {'ldm', 'pixartalpha'}:
|
||||
if model_cls in {'sd', 'sdxl', 'ldm', 'pixartalpha'}:
|
||||
model_cls = 'sd'
|
||||
variant = shared.opts.taesd_variant
|
||||
elif model_cls in {'pixartsigma', 'hunyuandit', 'omnigen', 'auraflow'}:
|
||||
@@ -89,7 +89,6 @@ def load_model(model_type = 'decoder', variant = None):
|
||||
if model_cls is None or model_cls == 'none':
|
||||
return None, variant
|
||||
model_cls, variant = get_model(model_cls, variant)
|
||||
print('HERE', model_cls, variant)
|
||||
if model_cls is None or variant is None:
|
||||
return None, variant
|
||||
folder = os.path.join(paths.models_path, "TAESD")
|
||||
|
||||
Reference in New Issue
Block a user