Compare commits

..
Author SHA1 Message Date
asagi4 be921a9eea Apparently 2.0.0b1 made Comfy Registry sad 2024-12-13 17:44:42 +02:00
asagi4 5aa6110206 Tag a beta version of 2.0.0 now that there's a legacy version published 2024-12-13 17:39:40 +02:00
asagi4 48b727f4f6 Well it didn't take long for me to find something to change 2024-12-13 00:39:24 +02:00
asagi4 5ff6d21e43 Simplify LazyLoraLoader since there's Advanced now 2024-12-13 00:38:19 +02:00
asagi4 d8b850cafd Fix typo 2024-12-13 00:29:24 +02:00
asagi4 24a9dd32f7 Fix links 2024-12-13 00:19:20 +02:00
asagi4 7b358e5127 Merge pull request #76 from asagi4/prep_v2
Good riddance to the old stuff
2024-12-13 00:17:06 +02:00
3 changed files with 20 additions and 13 deletions
+5 -5
View File
@@ -19,11 +19,11 @@ Prompt Control also comes with `PCTextEncode`, which provides advanced text enco
### Is it stable now?
Unless I run into bugs or significant annoyances that require changing the interface, probably.
Unless I run into bugs or significant annoyances that require changing the interface, it probably won't change too much, but until I tag 2.0, everything can change.
### Everything broke, where are the old nodes?
If you really need them, check out the [legacy branch](https://github.com/asagi4/comfyui-prompt-control/tree/legacy). However, I will not fix bugs in that branch, and I strongly recommend just migrating your workflows to the new nodes.
If you really need them, you can install the [legacy nodes](https://github.com/asagi4/comfyui-prompt-control-legacy). However, I will not fix bugs in those nodes, and I strongly recommend just migrating your workflows to the new nodes.
You can have both installed at the same time; none of the nodes conflict.
@@ -43,9 +43,9 @@ See the [syntax documentation](doc/syntax.md)
If you find prompt scheduling inconvenient for some reason, `PCTextEncode` can be used as a drop-in replacement for `CLIPTextEncode` to get everything else.
[This example workflow](workflows/example-lazy.json?raw=1) shows LoRA scheduling and prompt editing and compares it with the same prompt implemented with built-in ComfyUI nodes.
[This workflow](workflows/example-lazy.json?raw=1) shows LoRA scheduling and prompt editing and compares it with the same prompt implemented with built-in ComfyUI nodes.
[This example workflow](workflows/example.json?raw=1) implements a two-pass workflow illustrating more features, including custom masks and filtering.
[Here](workflows/example-2pass.json?raw=1) is a two-pass workflow illustrating more features, including custom masks and filtering.
The tools in this repository combine well with the macro and wildcard functionality in [comfyui-utility-nodes](https://github.com/asagi4/comfyui-utility-nodes)
@@ -65,7 +65,7 @@ Then restart ComfyUI afterwards.
# Core nodes
## PCLazyTextEncode and PCLazyTextEncodeAvanced
## PCLazyTextEncode and PCLazyTextEncodeAdvanced
`PCLazyTextEncode` uses ComfyUI's lazy graph execution mechanism to generate a graph of `PCTextEncode` and `SetConditioningTimestepRange` nodes from a prompt with schedules. This has the advantage that if a part of the schedule doesn't change, ComfyUI's caching mechanism allows you to avoid re-encoding the non-changed part.
+14 -7
View File
@@ -67,7 +67,7 @@ def create_hook_nodes_for_lora(graph, path, info, existing_node, start_pct, end_
return hook_node, next_keyframe
def build_lora_schedule(graph, schedule, model, clip, apply_hooks):
def build_lora_schedule(graph, schedule, model, clip, apply_hooks=True, return_hooks=True):
# This gets rid of non-existent LoRAs
consolidated = consolidate_schedule(schedule)
non_scheduled = find_nonscheduled_loras(consolidated)
@@ -116,7 +116,12 @@ def build_lora_schedule(graph, schedule, model, clip, apply_hooks):
r = graph.finalize()
return {"result": (model, clip, res), "expand": r}
if return_hooks:
ret = (model, clip, res)
else:
ret = (model, clip)
return {"result": ret, "expand": r}
class PCLazyLoraLoaderAdvanced:
@@ -145,7 +150,7 @@ class PCLazyLoraLoaderAdvanced:
def apply(self, model, clip, text, apply_hooks, unique_id, tags="", start=0.0, end=1.0):
schedule = parse_prompt_schedules(text).with_filters(filters=tags, start=start, end=end)
graph = GraphBuilder(f"PCLazyLoraLoaderAdvanced-{unique_id}")
return build_lora_schedule(graph, schedule, model, clip, apply_hooks)
return build_lora_schedule(graph, schedule, model, clip, apply_hooks=apply_hooks, return_hooks=True)
class PCLazyLoraLoader:
@@ -153,15 +158,17 @@ class PCLazyLoraLoader:
def INPUT_TYPES(s):
return {
"required": {
"text": ("STRING", {"multiline": True}),
"model": ("MODEL", {"rawLink": True}),
"clip": ("CLIP", {"rawLink": True}),
"apply_hooks": ("BOOLEAN", {"default": True}),
"text": ("STRING", {"multiline": True}),
},
"hidden": {"unique_id": "UNIQUE_ID"},
}
RETURN_TYPES = ("MODEL", "CLIP", "HOOKS")
RETURN_TYPES = (
"MODEL",
"CLIP",
)
OUTPUT_TOOLTIPS = ("Returns a model and clip with LoRAs scheduled",)
CATEGORY = "promptcontrol"
FUNCTION = "apply"
@@ -169,7 +176,7 @@ class PCLazyLoraLoader:
def apply(self, model, clip, text, apply_hooks, unique_id):
graph = GraphBuilder(f"PCLazyLoraLoader-{unique_id}")
schedule = parse_prompt_schedules(text)
return build_lora_schedule(graph, schedule, model, clip, apply_hooks)
return build_lora_schedule(graph, schedule, model, clip, apply_hooks=True, return_hooks=False)
def build_scheduled_prompts(graph, schedules, clip):
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-prompt-control"
description = "Nodes for convenient prompt editing, making many common operations prompt-controllable"
version = "1.2.1"
version = "2.0.0-beta.1"
license = { file = "LICENSE" }
# some lark versions older than 1.1.9 apparently have a bug that breaks things, see https://github.com/asagi4/comfyui-prompt-control/issues/35
dependencies = ["lark >= 1.1.9"]