Prompt Schedules - FizzleDorf/ComfyUI_FizzNodes GitHub Wiki

Prompt Schedule Nodes

Instructions Example
The regular versions of these nodes require the primitive nodes incremental output in the current_frame input. To set this up, simply right click on the node and convert current_frame to an input. Then, double click the input to add a primitive node. Set the node value control to increment and the value to 0. The primitive should look like this: primitiveNode
The text inputs pre_text and app_text are for appending or prepending text to every scheduled prompt. The primitive that is made from double clicking the input is single line and might be a little inconvenient. I reccomend using the TextBox from these modded nodes as the input for either of these inputs. text box
The Prompt Scheduler has multiple options that need to be converted to an input in order to properly use them. The Prompt weight channels (pw_a, pw_b, etc.) can take in the result from a Value scheduler giving full control of the token weight over time. value example
An example setup that includes prepended text and two prompt weight variables would look something like this: example setup

"Note: I used keyframe string generator to manually set the animation curves in the value schedule."


Nodes

Example Description
ScheduleNodes These nodes are a convenient way to schedule values over time. This includes anything with a float input, int input, prompts and prompt weights. This is done by interpolating the values at each keyframe and evaluating the expressions used in the inputs over time.
prompt schedule example Batch versions of these nodes are also available for processing prompts across batched latents. This is mandatory for using animate diff. You will notice there aren't any current frame inputs. This is because batching the latents occurs on one queue. The current frame is handled in code. These nodes do need max_frames to match the number of latents in the batch. either manually match the num_latents and max_frames or plug the latent output of the batch into the latent input of the alternate batch node (Latent Input).

Both nodes contain a max_frames value (unless you are using the latent_input version of the batch schedule) that determines the size of the series. This only needs to be equal to or higher than your last keyed prompt/value.


Variables and expressions

For expressions, you can check out supported numexpr operators and expressions and use them in your prompt.

Both nodes use the same variables:

Variable Definition
t the current frame in the sequence (zero indexed).
max_f the max frames the animation should calculate interpolations.
--neg splits the prompt so anything after --neg will be tokenized as a negative conditioning.

Prompt Schedule Only Variables include:

Variable Definition
pw_a prompt weight A
pw_b prompt weight B
pw_c prompt weight C
pw_d prompt weight D

The value of these prompt weight variables depends on what you give as an input.


Prompt Syntax

This node interpolates prompts and automates prompt weights over time using expressions in the prompt.

To keyframe a prompt, you need to format it correctly.

"#":"(prompt:`exp`)"

where # is the keyframe (as a whole number), prompt is your prompt, and exp is your expression.

The keyframe number needs to be enclosed by quotations ("") followed by a colon (:). Your prompt also needs to be enclosed in quotations (""). If you plan on having another keyframed prompt after this one, you need to place a comma (,) after the closing quote of your last prompt. If you don't do this you will get an error. If it is your last prompt do not place a comma as this will result in an error as well.

Expressions in the prompt schedule must be enclosed using back ticks: `` not apostrpophes: '' !!! If you are using prompt weight variables such as pw_a, make sure it's enclosed inside backticks as well.

An example of syntax is as follows:

"0": "1girl, solo, long grey hair, grey eyes, black sweater, (smiling:`(0.5+0.5*sin(t/12))`)",
"24": "1girl, solo, long grey hair, grey eyes, black sweater, (dancing:`pw_a`)",
"48": "1girl, solo, long grey hair, grey eyes, black sweater, (dancing:`pw_a`)",
"72": "1girl, solo, long grey hair, grey eyes, black sweater, (smiling:`(0.5+0.5*sin(t/max_f))`)"

To alleviate having to write the full prompt to every keyed frame, the prompts that stay the same through the whole animation can be prepended or appended to every prompt in the schedule using pre_text and app_text respectively. I would suggest using the text box suggested in the important notes section. Converting the above example would look like this:

pre_text

1girl, solo, long grey hair, grey eyes, black sweater,  

Scheduled Text

"0": "(smiling:`(0.5+0.5*sin(t/12))`)",
"24": "(dancing:`pw_a`)",
"48": "(dancing:`pw_a`)",
"72": "(smiling:`(0.5+0.5*sin(t/max_f))`)"```

This will be the same output prompts as the first example provided, makes the prompt schedule easy to read and it's easy to edit.