mirror of
https://github.com/vladmandic/automatic
synced 2026-09-11 15:28:43 +02:00
@@ -109,8 +109,10 @@ def set_pipeline_args(p, model, prompts:list, negative_prompts:list, prompts_2:t
|
||||
if hasattr(model, "set_progress_bar_config"):
|
||||
model.set_progress_bar_config(bar_format='Progress {rate_fmt}{postfix} {bar} {percentage:3.0f}% {n_fmt}/{total_fmt} {elapsed} {remaining} ' + '\x1b[38;5;71m' + desc, ncols=80, colour='#327fba')
|
||||
args = {}
|
||||
has_vae = hasattr(model, 'vae') or (hasattr(model, 'pipe') and hasattr(model.pipe, 'vae'))
|
||||
if hasattr(model, 'pipe') and not hasattr(model, 'no_recurse'): # recurse
|
||||
model = model.pipe
|
||||
has_vae = has_vae or hasattr(model, 'vae')
|
||||
signature = inspect.signature(type(model).__call__, follow_wrapped=True)
|
||||
possible = list(signature.parameters)
|
||||
|
||||
@@ -233,7 +235,7 @@ def set_pipeline_args(p, model, prompts:list, negative_prompts:list, prompts_2:t
|
||||
if sd_models.get_diffusers_task(model) == sd_models.DiffusersTaskType.TEXT_2_IMAGE:
|
||||
args['latents'] = p.init_latent
|
||||
if 'output_type' in possible:
|
||||
if not hasattr(model, 'vae'):
|
||||
if not has_vae:
|
||||
kwargs['output_type'] = 'np' # only set latent if model has vae
|
||||
|
||||
# model specific
|
||||
|
||||
@@ -27,7 +27,7 @@ def prompt_callback(step, kwargs):
|
||||
assert prompt_embeds.shape == kwargs['prompt_embeds'].shape, f"prompt_embed shape mismatch {kwargs['prompt_embeds'].shape} {prompt_embeds.shape}"
|
||||
kwargs['prompt_embeds'] = prompt_embeds
|
||||
except Exception as e:
|
||||
debug_callback(f"Callback: {e}")
|
||||
debug_callback(f"Callback: type=prompt {e}")
|
||||
return kwargs
|
||||
|
||||
|
||||
@@ -115,11 +115,16 @@ def diffusers_callback(pipe, step: int = 0, timestep: int = 0, kwargs: dict = {}
|
||||
shared.state.current_latent = kwargs['latents']
|
||||
shared.state.current_noise_pred = current_noise_pred
|
||||
|
||||
if hasattr(pipe, "scheduler") and hasattr(pipe.scheduler, "sigmas") and hasattr(pipe.scheduler, "step_index"):
|
||||
shared.state.current_sigma = pipe.scheduler.sigmas[pipe.scheduler.step_index - 1]
|
||||
shared.state.current_sigma_next = pipe.scheduler.sigmas[pipe.scheduler.step_index]
|
||||
if hasattr(pipe, "scheduler") and hasattr(pipe.scheduler, "sigmas") and hasattr(pipe.scheduler, "step_index") and pipe.scheduler.step_index is not None:
|
||||
try:
|
||||
shared.state.current_sigma = pipe.scheduler.sigmas[pipe.scheduler.step_index-1]
|
||||
shared.state.current_sigma_next = pipe.scheduler.sigmas[pipe.scheduler.step_index]
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
shared.log.error(f'Callback: {e}')
|
||||
# from modules import errors
|
||||
# errors.display(e, 'Callback')
|
||||
if shared.cmd_opts.profile and shared.profiler is not None:
|
||||
shared.profiler.step()
|
||||
t1 = time.time()
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ def progressapi(req: ProgressRequest):
|
||||
id_live_preview = req.id_live_preview
|
||||
live_preview = None
|
||||
updated = shared.state.set_current_image()
|
||||
debug_log(f'Preview: job={shared.state.job} active={active} progress={current}/{total} step={shared.state.current_image_sampling_step}/{shared.state.sampling_step} request={id_live_preview} last={shared.state.id_live_preview} enabled={shared.opts.live_previews_enable} job={shared.state.preview_job} updated={updated} image={shared.state.current_image} elapsed={elapsed:.3f}')
|
||||
debug_log(f'Preview: job={shared.state.job} active={active} progress={current}/{total} step={shared.state.current_image_sampling_step}/{step_x}/{step_y} request={id_live_preview} last={shared.state.id_live_preview} enabled={shared.opts.live_previews_enable} job={shared.state.preview_job} updated={updated} image={shared.state.current_image} elapsed={elapsed:.3f}')
|
||||
if not active:
|
||||
return InternalProgressResponse(job=shared.state.job, active=active, queued=queued, paused=paused, completed=completed, id_live_preview=-1, debug=debug, textinfo="Queued..." if queued else "Waiting...")
|
||||
if shared.opts.live_previews_enable and (shared.state.id_live_preview != id_live_preview) and (shared.state.current_image is not None):
|
||||
|
||||
Reference in New Issue
Block a user