Fix ALG crash on multi-scene: tensor 'or' in alg_latents (True,True) fallback

sample_funpack_distilled_flow built the alg_latents dict eagerly, and the
(True, True) value used 'anchor_blurred or tail_blurred' as its fallback when
both_blurred was None. When anchor blur is on but tail blur is off (or the tail
blur returned None), anchor_blurred is a multi-element tensor, so 'or' calls
bool() on it -> 'Boolean value of Tensor with more than one value is ambiguous'.

Surfaces only on continuation scenes: an anchorless first scene (identity/empty
latent, no denoise_mask) skips ALG entirely, but a later scene with a guide mask
enters ALG and trips the eager dict build. Replaced the tensor 'or' with explicit
None chaining (both -> anchor -> tail). Pure fallback; when (True,True) is actually
indexed both blurs are on, so both_blurred is non-None and the singles are never
reached. Independent of taste_nearest_prompt, which was merely on in the same run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
digital-garbage
2026-07-13 20:47:18 +03:00
co-authored by Claude Opus 4.8
parent 70f405b0e4
commit bb4a87b4b5
+9 -1
View File
@@ -1869,7 +1869,15 @@ def sample_funpack_distilled_flow(model, x, sigmas, extra_args=None, callback=No
(False, False): alg_sharp_latent_image,
(True, False): anchor_blurred,
(False, True): tail_blurred,
(True, True): both_blurred if both_blurred is not None else (anchor_blurred or tail_blurred),
# both → anchor → tail → None. Explicit None checks, NOT `anchor_blurred or
# tail_blurred`: `or` calls bool() on the first operand, which is a multi-element
# tensor when anchor blur is on but tail blur is off (both_blurred is then None) —
# "Boolean value of Tensor is ambiguous". This value is only a defensive fallback:
# when (True, True) is actually indexed, alg_anchor_on and alg_tail_on are both
# True, so both_blurred is non-None and the chain never reaches the singles.
(True, True): (both_blurred if both_blurred is not None
else anchor_blurred if anchor_blurred is not None
else tail_blurred),
}
alg_active = alg_anchor_on or alg_tail_on
if alg_active: