fix(processing): re-apply attention when the overrides change

The generate-time gate compared the stored processor name against the
sdp_overrides list, which can never be equal, so the check reduced to
the processor name alone and a changed override set was never applied
until the next model load. set_diffusers_attention now stamps the
override set it applied beside the processor name, the gate compares
both, and pipe switches carry the new attribute with the old one.
This commit is contained in:
CalamitousFelicitousness
2026-08-22 22:06:36 +01:00
parent bb0cc5328e
commit 9d1d7c839a
3 changed files with 7 additions and 2 deletions
+3 -2
View File
@@ -546,8 +546,9 @@ def update_pipeline(sd_model, p: processing.StableDiffusionProcessing):
global orig_pipeline # pylint: disable=global-statement
orig_pipeline = updated_model # processed ONNX pipeline should not be replaced with original pipeline.
current_attn = getattr(updated_model, "current_attn_name", None)
if (current_attn != shared.opts.cross_attention_optimization) and (current_attn != shared.opts.sdp_overrides):
log.info(f"Setting attention optimization: {shared.opts.cross_attention_optimization}")
current_overrides = getattr(updated_model, "current_attn_overrides", None)
if current_attn != shared.opts.cross_attention_optimization or current_overrides != list(shared.opts.sdp_overrides):
log.info(f"Setting attention optimization: {shared.opts.cross_attention_optimization} overrides={shared.opts.sdp_overrides}")
attention.set_diffusers_attention(updated_model)
return updated_model