Rename nodes for consistency

This commit is contained in:
asagi4
2024-12-11 19:28:52 +02:00
parent fcb63aefa6
commit fd673a0d5b
3 changed files with 14 additions and 18 deletions
+5 -5
View File
@@ -22,7 +22,7 @@ See [features](#features) below. Things you can control via the prompt:
- Prompt masking with cutoff
- SDXL parameters
If you find prompt scheduling inconvenient, `PCEncodeSingle` can be used as a drop-in replacement for `CLIPTextEncode` to get everything else.
If you find prompt scheduling inconvenient, `PCTextEncode` can be used as a drop-in replacement for `CLIPTextEncode` to get everything else.
[This example workflow](workflows/example.json?raw=1) implements a two-pass workflow illustrating most scheduling features.
@@ -58,7 +58,7 @@ See the [syntax documentation](doc/syntax.md)
## Advanced CLIP encoding
If you use `PCEncodeSchedule` or `PCEncodeSingle`. advanced encodings are available automatically. Thanks to BlenderNeko for the original code.
If you use `PCEncodeSchedule` or `PCTextEncode`. advanced encodings are available automatically. Thanks to BlenderNeko for the original code.
You can use the syntax `STYLE(weight_interpretation, normalization)` in a prompt to affect how prompts are interpreted.
@@ -126,7 +126,7 @@ The hooks can be a bit slow sometimes, especially in cases where the LoRA spec d
Encodes all prompts in a schedule. Pass in a `CLIP` object with hooks attached for LoRA scheduling, then use the resulting `CONDITIONING` normally
## PCEncodeSingle
## PCTextEncode
Encodes a single prompt *without* scheduling or LoRA loading features (but including everything else).
@@ -164,11 +164,11 @@ Add masks to a schedule object, for use with IMASK (see [syntax documentation](d
# Experimental nodes
## PCLazyEncode
`PCLazyEncode` is an experiment that uses ComfyUI's lazy graph execution mechanism to dynamically generate a graph of `PCEncodeSingle` 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.
`PCLazyEncode` is an experiment that uses ComfyUI's lazy graph execution mechanism to dynamically 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.
for example, if you first encode `[cat:dog:0.1]` and later change that to `[cat:dog:0.5]`, no re-encoding takes place.
for added fun, put `NODE(NodeClassName, paramname)` in a prompt to encode the text using any other node (the default is to use `PCEncodeSingle` and `text`)
for added fun, put `NODE(NodeClassName, paramname)` in a prompt to encode the text using any other node (the default is to use `PCTextEncode` and `text`)
Note that the node can't have required parameters besides a single CLIP parameter (which must be named `clip`) and the text prompt, and it must return a `CONDITIONING` as its first return value.
+3 -6
View File
@@ -4,7 +4,6 @@ import comfy.hooks
import folder_paths
from .prompts import encode_prompt
from .utils import lora_name_to_file
import nodes
log = logging.getLogger("comfyui-prompt-control")
@@ -42,7 +41,7 @@ class PCEncodeSchedule:
return (encode_schedule(clip, prompt_schedule),)
class PCEncodeSingle:
class PCTextEncode:
@classmethod
def INPUT_TYPES(s):
return {
@@ -167,14 +166,12 @@ def encode_schedule(clip, schedules):
NODE_CLASS_MAPPINGS = {
"PCLoraHooksFromSchedule": PCLoraHooksFromSchedule,
"PCLoraHooksFromScheduleWithOptimizationTest": PCLoraHooksFromScheduleWithOptimizationTest,
"PCEncodeSchedule": PCEncodeSchedule,
"PCEncodeSingle": PCEncodeSingle,
"PCTextEncode": PCTextEncode,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"PCLoraHooksFromSchedule": "PC Create LoRA Hooks",
"PCLoraHooksFromScheduleWithOptimizationTest": "PC Create LoRA Hooks (with model optimization) (EXPERIMENTAL)",
"PCEncodeSchedule": "PC Encode Schedule",
"PCEncodeSingle": "PC Encode Single Prompt (no scheduling)",
"PCTextEncode": "PC Text Encode (no scheduling)",
}
+6 -7
View File
@@ -132,7 +132,7 @@ class PCLazyLoraLoader:
return {"result": (modelinput, clipinput, res), "expand": r}
class PCLazyEncode:
class PCLazyTextEncode:
@classmethod
def INPUT_TYPES(s):
return {
@@ -157,8 +157,8 @@ class PCLazyEncode:
start_pct = 0.0
for end_pct, c in schedules:
p = c["prompt"]
p, classnames = get_function(p, "NODE", ["PCEncodeSingle", "text"])
classname = "PCEncodeSingle"
p, classnames = get_function(p, "NODE", ["PCTextEncode", "text"])
classname = "PCTextEncode"
paramname = "text"
if classnames:
classname = classnames[0][0]
@@ -183,12 +183,11 @@ class PCLazyEncode:
NODE_CLASS_MAPPINGS = {
"PCLazyEncode": PCLazyEncode,
"PCLazyTextEncode": PCLazyTextEncode,
"PCLazyLoraLoader": PCLazyLoraLoader,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"PCLazyEncode": "Encode a prompt with scheduling (Lazy) (EXPERIMENTAL)"
"PCLazyLoraLoader"
"Schedule LoRAs from a given prompt (Lazy) (EXPERIMENTAL)"
"PCLazyTextEncode": "Encode prompt w/ scheduling (Lazy) (EXPERIMENTAL)",
"PCLazyLoraLoader": "Load LoRAs from prompt w/ scheduling (Lazy) (EXPERIMENTAL)",
}