From b35ab93f8b4b13e593ca19503ef0a8155ac60b33 Mon Sep 17 00:00:00 2001 From: blepping Date: Mon, 15 Apr 2024 16:33:42 -0600 Subject: [PATCH] BlehBlockOps: turn off dynamic prompts, fix issue with step calculation --- README.md | 2 -- py/nodes/ops.py | 12 +++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 58c91d1..2b64616 100644 --- a/README.md +++ b/README.md @@ -121,8 +121,6 @@ SDXL is not going to work at all. Very experimental advanced node that allows defining model patches using YAML. This node is still under development and may be changed. -**Note**: ComfyUI seems to strip out curly braces so you can't use YAML's inline object notation. You can use `<` and `>` instead. - The top level YAML should consist of a list of objects with a condition `if`, a list of `ops` that run if the condition succeeds. Objects `then` and `else` also take the same form as the top level object and apply when the `if` condition matches (or not in the case of `else`). diff --git a/py/nodes/ops.py b/py/nodes/ops.py index 73a75b0..ac4d950 100644 --- a/py/nodes/ops.py +++ b/py/nodes/ops.py @@ -457,9 +457,7 @@ class Rule: class RuleGroup: @classmethod - def from_yaml(cls, s: str, curlybrace_hack=True) -> object: - if curlybrace_hack: - s = s.replace("<", "{").replace(">", "}") + def from_yaml(cls, s: str) -> object: parsed_rules = yaml.safe_load(s) return cls(tuple(Rule.from_dict(r)[0] for r in parsed_rules)) @@ -485,7 +483,7 @@ class BlehBlockOps: return { "required": { "model": ("MODEL",), - "rules": ("STRING", {"multiline": True}), + "rules": ("STRING", {"multiline": True, "dynamicPrompts": False}), }, "optional": { "sigmas_opt": ("SIGMAS",), @@ -523,8 +521,8 @@ class BlehBlockOps: def set_state_step(state, sigma): if sigmas_opt is None: - state[Condtype.STEP_EXACT] = state[CondType.STEP] = -1 - return st + state[CondType.STEP_EXACT] = state[CondType.STEP] = -1 + return state sigmadiff, idx = torch.min(torch.abs(sigmas_opt[:-1] - sigma), 0) idx = idx.item() state |= { @@ -659,7 +657,7 @@ class BlehLatentOps: return { "required": { "samples": ("LATENT",), - "rules": ("STRING", {"multiline": True}), + "rules": ("STRING", {"multiline": True, "dynamicPrompts": False}), }, }