From bb4a87b4b50ee816ddb2f76c0be594867debb03a Mon Sep 17 00:00:00 2001 From: digital-garbage <133010426+digital-garbage@users.noreply.github.com> Date: Mon, 13 Jul 2026 20:47:18 +0300 Subject: [PATCH] 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 --- samplers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samplers.py b/samplers.py index 633374e5..cfaec5d9 100644 --- a/samplers.py +++ b/samplers.py @@ -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: