Noise merging: say it is on at the start of every run, and say so when no step matched
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmbxSsiiz8wmt226dtbFXe
This commit is contained in:
@@ -101,11 +101,19 @@ def install(patcher, values, key):
|
||||
return None
|
||||
b_first = values.get("order", "b_into_a") == "b_into_a"
|
||||
chosen = int(values.get("seed", -1))
|
||||
live = {"seed": max(chosen, 0)}
|
||||
live = {"seed": max(chosen, 0), "merged": 0}
|
||||
|
||||
def start(executor, *args, **kwargs):
|
||||
live["seed"] = chosen if chosen >= 0 else random.randrange(2 ** 31)
|
||||
return executor(*args, **kwargs)
|
||||
live["merged"] = 0
|
||||
log.info("FunUI Noise merging", f"on: steps {values.get('steps')}, strength {strength:.2f}, "
|
||||
f"second seed {live['seed']}")
|
||||
try:
|
||||
return executor(*args, **kwargs)
|
||||
finally:
|
||||
if not live["merged"]:
|
||||
_say("Inactive | no step of this run matched the steps you named "
|
||||
"(or the model was not called as a plain prompt step)")
|
||||
|
||||
patcher.add_wrapper_with_key(WrappersMP.OUTER_SAMPLE, key, start)
|
||||
|
||||
@@ -132,6 +140,7 @@ def install(patcher, values, key):
|
||||
if split_b is None:
|
||||
return out
|
||||
video_b, rebuild_b = split_b
|
||||
live["merged"] += 1
|
||||
diff = float((video_a - video_b).norm() / video_a.norm().clamp(min=1e-8))
|
||||
log.info("FunUI Noise merging",
|
||||
f"step {where[0] + 1}: second answer differs from the first by {diff:.1%}, "
|
||||
|
||||
@@ -106,3 +106,19 @@ def test_a_negative_seed_is_new_each_run_and_a_number_is_kept(tiny_h3):
|
||||
for _ in range(2):
|
||||
outer(lambda: wrap(model, x0.clone(), _sched()[0:1], None, None, None, _to(0), latent_shapes=shapes))
|
||||
assert torch.equal(seen[1], seen[3]) is same
|
||||
|
||||
|
||||
def test_the_log_says_the_feature_is_on_and_when_nothing_matched(tiny_h3):
|
||||
from comfy.patcher_extension import WrappersMP
|
||||
from core import log
|
||||
from modules.sampling.modifiers.nodes import FunUILoadModifiers
|
||||
x0, shapes = _packed()
|
||||
patched, _ = FunUILoadModifiers.execute(
|
||||
tiny_h3.patcher, {"noise_merge": {"enabled": True, "steps": "9"}}).result
|
||||
wrap = [w for ws in patched.wrappers[WrappersMP.APPLY_MODEL].values() for w in ws][-1]
|
||||
outer = [w for ws in patched.wrappers[WrappersMP.OUTER_SAMPLE].values() for w in ws][-1]
|
||||
log.new_run()
|
||||
outer(lambda: wrap(lambda *a, **k: x0, x0.clone(), _sched()[0:1], None, None, None, _to(0), latent_shapes=shapes))
|
||||
texts = [e["message"] for e in log.history()]
|
||||
assert any(t.startswith("on: steps 9") for t in texts)
|
||||
assert any("no step of this run matched" in t for t in texts)
|
||||
|
||||
Reference in New Issue
Block a user