some more refactoring
This commit is contained in:
+40
-52
@@ -85,21 +85,19 @@ def batch_split_weighted_subprompts(text, pre_text, app_text):
|
||||
neg[frame] = neg[frame][:-1]
|
||||
return pos, neg
|
||||
|
||||
#converts the prompt weight variables to tuples. if it is an int variable,
|
||||
#set all frames to have the same value
|
||||
# converts the prompt weight variables to tuples. if it is an int variable,
|
||||
# set all frames to have the same value
|
||||
def convert_pw_to_tuples(settings):
|
||||
if isinstance(settings.pw_a, (int, float, np.float64)):
|
||||
settings.pw_a = tuple([settings.pw_a] * settings.max_frames)
|
||||
|
||||
if isinstance(settings.pw_b, (int, float, np.float64)):
|
||||
settings.pw_b = tuple([settings.pw_b] * settings.max_frames)
|
||||
|
||||
if isinstance(settings.pw_c, (int, float, np.float64)):
|
||||
settings.pw_c = tuple([settings.pw_c] * settings.max_frames)
|
||||
|
||||
if isinstance(settings.pw_d, (int, float, np.float64)):
|
||||
settings.pw_d = tuple([settings.pw_d] * settings.max_frames)
|
||||
|
||||
|
||||
def interpolate_prompt_seriesA(animation_prompts, settings:ScheduleSettings):
|
||||
|
||||
max_f = settings.max_frames # needed for numexpr even though it doesn't look like it's in use.
|
||||
@@ -301,7 +299,9 @@ def interpolate_prompt_series(animation_prompts, max_frames, start_frame, pre_te
|
||||
# if it is an in-between frame and the prompts differ, composable diffusion will be performed.
|
||||
return (cur_prompt_series, nxt_prompt_series, weight_series)
|
||||
|
||||
def encode_and_pad(cur_prompt_series, nxt_prompt_series,clip):
|
||||
|
||||
return clip
|
||||
def BatchPoolAnimConditioning(cur_prompt_series, nxt_prompt_series, weight_series, clip):
|
||||
pooled_out = []
|
||||
cond_out = []
|
||||
@@ -339,9 +339,6 @@ def BatchPoolAnimConditioning(cur_prompt_series, nxt_prompt_series, weight_serie
|
||||
return [[final_conditioning, {"pooled_output": final_pooled_output}]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def BatchGLIGENConditioning(cur_prompt_series, nxt_prompt_series, weight_series, clip):
|
||||
pooled_out = []
|
||||
cond_out = []
|
||||
@@ -395,15 +392,14 @@ def BatchPoolAnimConditioningSDXL(cur_prompt_series, nxt_prompt_series, weight_s
|
||||
return [[final_conditioning, {"pooled_output": final_pooled_output}]]
|
||||
|
||||
|
||||
def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_frames, clip, app_text_G,
|
||||
app_text_L, pre_text_G, pre_text_L, pw_a, pw_b, pw_c, pw_d, width, height, crop_w,
|
||||
crop_h, target_width, target_height, Is_print = False):
|
||||
|
||||
def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, clip, settings: ScheduleSettings):
|
||||
convert_pw_to_tuples(settings)
|
||||
# parse the conditioning strength and determine in-betweens.
|
||||
# Get prompts sorted by keyframe
|
||||
max_f = max_frames # needed for numexpr even though it doesn't look like it's in use.
|
||||
max_f = settings.max_frames # needed for numexpr even though it doesn't look like it's in use.
|
||||
parsed_animation_promptsG = {}
|
||||
parsed_animation_promptsL = {}
|
||||
|
||||
for key, value in animation_promptsG.items():
|
||||
if check_is_number(key): # default case 0:(1 + t %5), 30:(5-t%2)
|
||||
parsed_animation_promptsG[key] = value
|
||||
@@ -421,14 +417,14 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
sorted_prompts_L = sorted(parsed_animation_promptsL.items(), key=lambda item: int(item[0]))
|
||||
|
||||
# Setup containers for interpolated prompts
|
||||
cur_prompt_series_G = pd.Series([np.nan for a in range(max_frames)])
|
||||
nxt_prompt_series_G = pd.Series([np.nan for a in range(max_frames)])
|
||||
cur_prompt_series_G = pd.Series([np.nan for a in range(settings.max_frames)])
|
||||
nxt_prompt_series_G = pd.Series([np.nan for a in range(settings.max_frames)])
|
||||
|
||||
cur_prompt_series_L = pd.Series([np.nan for a in range(max_frames)])
|
||||
nxt_prompt_series_L = pd.Series([np.nan for a in range(max_frames)])
|
||||
cur_prompt_series_L = pd.Series([np.nan for a in range(settings.max_frames)])
|
||||
nxt_prompt_series_L = pd.Series([np.nan for a in range(settings.max_frames)])
|
||||
|
||||
# simple array for strength values
|
||||
weight_series = [np.nan] * max_frames
|
||||
weight_series = [np.nan] * settings.max_frames
|
||||
|
||||
def constructPrompt(sorted_prompts, cur_prompt, nxt_prompt, pre_text, app_text):
|
||||
if len(sorted_prompts) - 1 == 0:
|
||||
@@ -439,10 +435,9 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
return cur_prompt, nxt_prompt
|
||||
|
||||
# in case there is only one keyed promt, set all prompts to that prompt
|
||||
cur_prompt_series_G, nxt_prompt_series_G = constructPrompt(sorted_prompts_G, cur_prompt_series_G, nxt_prompt_series_G, pre_text_G, app_text_G)
|
||||
cur_prompt_series_G, nxt_prompt_series_G = constructPrompt(sorted_prompts_G, cur_prompt_series_G, nxt_prompt_series_G, settings.pre_text_G, settings.app_text_G)
|
||||
cur_prompt_series_L, nxt_prompt_series_L = constructPrompt(sorted_prompts_G, cur_prompt_series_G,
|
||||
nxt_prompt_series_G, pre_text_G, app_text_G)
|
||||
print("Debug: ", cur_prompt_series_G, nxt_prompt_series_G)
|
||||
nxt_prompt_series_G, settings.pre_text_G, settings.app_text_G)
|
||||
if len(sorted_prompts_L) - 1 == 0:
|
||||
for i in range(0, len(cur_prompt_series_L) - 1):
|
||||
current_prompt_L = sorted_prompts_L[0][1]
|
||||
@@ -478,18 +473,18 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
current_weight = 1 - next_weight
|
||||
|
||||
# add the appropriate prompts and weights to their respective containers.
|
||||
if f < max_frames:
|
||||
if f < settings.max_frames:
|
||||
cur_prompt_series_G[f] = ''
|
||||
nxt_prompt_series_G[f] = ''
|
||||
weight_series[f] = 0.0
|
||||
|
||||
cur_prompt_series_G[f] += (str(pre_text_G) + " " + str(current_prompt_G) + " " + str(app_text_G))
|
||||
nxt_prompt_series_G[f] += (str(pre_text_G) + " " + str(next_prompt_G) + " " + str(app_text_G))
|
||||
cur_prompt_series_G[f] += (str(settings.pre_text_G) + " " + str(current_prompt_G) + " " + str(settings.app_text_G))
|
||||
nxt_prompt_series_G[f] += (str(settings.pre_text_G) + " " + str(next_prompt_G) + " " + str(settings.app_text_G))
|
||||
|
||||
weight_series[f] += current_weight
|
||||
|
||||
current_key = next_key
|
||||
next_key = max_frames
|
||||
next_key = settings.max_frames
|
||||
current_weight = 0.0
|
||||
# second loop to catch any nan runoff
|
||||
for f in range(current_key, next_key):
|
||||
@@ -500,16 +495,15 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
nxt_prompt_series_G[f] = ''
|
||||
weight_series[f] = current_weight
|
||||
|
||||
cur_prompt_series_G[f] += (str(pre_text_G) + " " + str(current_prompt_G) + " " + str(app_text_G))
|
||||
nxt_prompt_series_G[f] += (str(pre_text_G) + " " + str(next_prompt_G) + " " + str(app_text_G))
|
||||
cur_prompt_series_G[f] += (str(settings.pre_text_G) + " " + str(current_prompt_G) + " " + str(settings.app_text_G))
|
||||
nxt_prompt_series_G[f] += (str(settings.pre_text_G) + " " + str(next_prompt_G) + " " + str(settings.app_text_G))
|
||||
|
||||
# Reset outside of loop for nan check
|
||||
current_key = 0
|
||||
next_key = 0
|
||||
|
||||
# For every keyframe prompt except the last
|
||||
for i in range(0, len(sorted_prompts_L) - 1):
|
||||
# Get current and next keyframe
|
||||
|
||||
current_key = int(sorted_prompts_L[i][0])
|
||||
next_key = int(sorted_prompts_L[i + 1][0])
|
||||
|
||||
@@ -532,18 +526,18 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
current_weight = 1 - next_weight
|
||||
|
||||
# add the appropriate prompts and weights to their respective containers.
|
||||
if f < max_frames:
|
||||
if f < settings.max_frames:
|
||||
cur_prompt_series_L[f] = ''
|
||||
nxt_prompt_series_L[f] = ''
|
||||
weight_series[f] = 0.0
|
||||
|
||||
cur_prompt_series_L[f] += (str(pre_text_L) + " " + str(current_prompt_L) + " " + str(app_text_L))
|
||||
nxt_prompt_series_L[f] += (str(pre_text_L) + " " + str(next_prompt_L) + " " + str(app_text_L))
|
||||
cur_prompt_series_L[f] += (str(settings.pre_text_L) + " " + str(current_prompt_L) + " " + str(settings.app_text_L))
|
||||
nxt_prompt_series_L[f] += (str(settings.pre_text_L) + " " + str(next_prompt_L) + " " + str(settings.app_text_L))
|
||||
|
||||
weight_series[f] += current_weight
|
||||
|
||||
current_key = next_key
|
||||
next_key = max_frames
|
||||
next_key = settings.max_frames
|
||||
current_weight = 0.0
|
||||
# second loop to catch any nan runoff
|
||||
for f in range(current_key, next_key):
|
||||
@@ -554,19 +548,15 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
nxt_prompt_series_L[f] = ''
|
||||
weight_series[f] = current_weight
|
||||
|
||||
cur_prompt_series_L[f] += (str(pre_text_L) + " " + str(current_prompt_L) + " " + str(app_text_L))
|
||||
nxt_prompt_series_L[f] += (str(pre_text_L) + " " + str(next_prompt_L) + " " + str(app_text_L))
|
||||
cur_prompt_series_L[f] += (str(settings.pre_text_L) + " " + str(current_prompt_L) + " " + str(settings.app_text_L))
|
||||
nxt_prompt_series_L[f] += (str(settings.pre_text_L) + " " + str(next_prompt_L) + " " + str(settings.app_text_L))
|
||||
|
||||
# Evaluate the current and next prompt's expressions
|
||||
for i in range(0, max_frames):
|
||||
cur_prompt_series_G[i] = prepare_batch_prompt(cur_prompt_series_G[i], max_frames, i,
|
||||
pw_a, pw_b, pw_c, pw_d)
|
||||
nxt_prompt_series_G[i] = prepare_batch_prompt(nxt_prompt_series_G[i], max_frames, i,
|
||||
pw_a, pw_b, pw_c, pw_d)
|
||||
cur_prompt_series_L[i] = prepare_batch_prompt(cur_prompt_series_L[i], max_frames, i,
|
||||
pw_a, pw_b, pw_c, pw_d)
|
||||
nxt_prompt_series_L[i] = prepare_batch_prompt(nxt_prompt_series_L[i], max_frames, i,
|
||||
pw_a, pw_b, pw_c, pw_d)
|
||||
for i in range(0, settings.max_frames):
|
||||
cur_prompt_series_G[i] = prepare_batch_promptA(cur_prompt_series_G[i], settings, i)
|
||||
nxt_prompt_series_G[i] = prepare_batch_promptA(nxt_prompt_series_G[i], settings, i)
|
||||
cur_prompt_series_L[i] = prepare_batch_promptA(cur_prompt_series_L[i], settings, i)
|
||||
nxt_prompt_series_L[i] = prepare_batch_promptA(nxt_prompt_series_L[i], settings, i)
|
||||
|
||||
current_conds = []
|
||||
next_conds = []
|
||||
@@ -589,16 +579,14 @@ def BatchInterpolatePromptsSDXL(animation_promptsG, animation_promptsL, max_fram
|
||||
|
||||
max_size = max(max_size_G,max_size_L)
|
||||
|
||||
for i in range(0, max_frames):
|
||||
current_conds.append(SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height,
|
||||
cur_prompt_series_G[i], cur_prompt_series_L[i]))
|
||||
next_conds.append(SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height,
|
||||
nxt_prompt_series_G[i], nxt_prompt_series_L[i]))
|
||||
for i in range(0, settings.max_frames):
|
||||
current_conds.append(SDXLencode(cur_prompt_series_G[i], cur_prompt_series_L[i], settings, clip))
|
||||
next_conds.append(SDXLencode(nxt_prompt_series_L[i], nxt_prompt_series_L[i], settings, clip))
|
||||
|
||||
if Is_print == True:
|
||||
if settings.print_output == True:
|
||||
# Show the to/from prompts with evaluated expressions for transparency.
|
||||
for i in range(0, max_frames):
|
||||
print("\n", "Max Frames: ", max_frames, "\n", "Current Prompt G: ", cur_prompt_series_G[i],
|
||||
for i in range(0, settings.max_frames):
|
||||
print("\n", "Max Frames: ", settings.max_frames, "\n", "Current Prompt G: ", cur_prompt_series_G[i],
|
||||
"\n", "Current Prompt L: ", cur_prompt_series_L[i], "\n", "Next Prompt G: ", nxt_prompt_series_G[i],
|
||||
"\n", "Next Prompt L : ", nxt_prompt_series_L[i], "\n"), "\n", "Current weight: ", weight_series[i]
|
||||
|
||||
|
||||
+20
-12
@@ -17,7 +17,7 @@ import json
|
||||
class ScheduleSettings:
|
||||
def __init__(
|
||||
self,
|
||||
text_G: str,
|
||||
text_g: str,
|
||||
pre_text_G: str,
|
||||
app_text_G: str,
|
||||
text_L: str,
|
||||
@@ -38,10 +38,10 @@ class ScheduleSettings:
|
||||
target_width: int,
|
||||
target_height: int,
|
||||
):
|
||||
self.text_G=text_G
|
||||
self.text_g=text_g
|
||||
self.pre_text_G=pre_text_G
|
||||
self.app_text_G=app_text_G
|
||||
self.text_L=text_L
|
||||
self.text_l=text_L
|
||||
self.pre_text_L=pre_text_L
|
||||
self.app_text_L=app_text_L
|
||||
self.max_frames=max_frames
|
||||
@@ -83,6 +83,8 @@ def addWeighted(conditioning_to, conditioning_from, conditioning_to_strength, ma
|
||||
tw = torch.mul(t1, conditioning_to_strength) + torch.mul(t0, (1.0 - conditioning_to_strength))
|
||||
t_to = conditioning_to[i][1].copy()
|
||||
|
||||
t_to["pooled_output"] = pooled_output_from
|
||||
|
||||
if pooled_output_from is not None and pooled_output_to is not None:
|
||||
# Pad pooled outputs if available
|
||||
pooled_output_to = pad_with_zeros(pooled_output_to, max_size)
|
||||
@@ -277,9 +279,9 @@ def PoolAnimConditioning(cur_prompt, nxt_prompt, weight, clip):
|
||||
cond_to, pooled_to = clip.encode_from_tokens(tokens, return_pooled=True)
|
||||
return addWeighted([[cond_to, {"pooled_output": pooled_to}]], [[cond_from, {"pooled_output": pooled_from}]], weight)
|
||||
|
||||
def SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l):
|
||||
tokens = clip.tokenize(text_g)
|
||||
tokens["l"] = clip.tokenize(text_l)["l"]
|
||||
def SDXLencode(g, l, settings:ScheduleSettings, clip):
|
||||
tokens = clip.tokenize(g)
|
||||
tokens["l"] = clip.tokenize(l)["l"]
|
||||
if len(tokens["l"]) != len(tokens["g"]):
|
||||
empty = clip.tokenize("")
|
||||
while len(tokens["l"]) < len(tokens["g"]):
|
||||
@@ -287,7 +289,15 @@ def SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height,
|
||||
while len(tokens["l"]) > len(tokens["g"]):
|
||||
tokens["g"] += empty["g"]
|
||||
cond, pooled = clip.encode_from_tokens(tokens, return_pooled=True)
|
||||
return [[cond, {"pooled_output": pooled, "width": width, "height": height, "crop_w": crop_w, "crop_h": crop_h, "target_width": target_width, "target_height": target_height}]]
|
||||
return [[cond, {
|
||||
"pooled_output": pooled,
|
||||
"width": settings.width,
|
||||
"height": settings.height,
|
||||
"crop_w": settings.crop_w,
|
||||
"crop_h": settings.crop_h,
|
||||
"target_width": settings.target_width,
|
||||
"target_height": settings.target_height
|
||||
}]]
|
||||
|
||||
def interpolate_prompts_SDXL(animation_promptsG, animation_promptsL, max_frames, current_frame, clip, app_text_G, app_text_L, pre_text_G, pre_text_L, pw_a, pw_b, pw_c, pw_d, width, height, crop_w, crop_h, target_width, target_height, print_output): #parse the conditioning strength and determine in-betweens.
|
||||
#Get prompts sorted by keyframe
|
||||
@@ -333,8 +343,6 @@ def interpolate_prompts_SDXL(animation_promptsG, animation_promptsL, max_frames,
|
||||
cur_prompt_series_L[i] = str(pre_text_L) + " " + str(current_prompt_L) + " " + str(app_text_L)
|
||||
nxt_prompt_series_L[i] = str(pre_text_L) + " " + str(current_prompt_L) + " " + str(app_text_L)
|
||||
|
||||
|
||||
|
||||
#Initialized outside of loop for nan check
|
||||
current_key = 0
|
||||
next_key = 0
|
||||
@@ -453,7 +461,7 @@ def interpolate_prompts_SDXL(animation_promptsG, animation_promptsL, max_frames,
|
||||
|
||||
#Output methods depending if the prompts are the same or if the current frame is a keyframe.
|
||||
#if it is an in-between frame and the prompts differ, composable diffusion will be performed.
|
||||
current_cond = SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height, cur_prompt_series_G[current_frame], cur_prompt_series_L[current_frame])
|
||||
current_cond = SDXLencode(settings, clip, cur_prompt_series_G[current_frame], cur_prompt_series_L[current_frame])
|
||||
|
||||
if str(cur_prompt_series_G[current_frame]) == str(nxt_prompt_series_G[current_frame]) and str(cur_prompt_series_L[current_frame]) == str(nxt_prompt_series_L[current_frame]):
|
||||
return current_cond
|
||||
@@ -462,9 +470,9 @@ def interpolate_prompts_SDXL(animation_promptsG, animation_promptsL, max_frames,
|
||||
return current_cond
|
||||
|
||||
if weight_series[current_frame] == 0:
|
||||
next_cond = SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height, cur_prompt_series_G[current_frame], cur_prompt_series_L[current_frame])
|
||||
next_cond = SDXLencode(settings, clip, nxt_prompt_series_G[current_frame], nxt_prompt_series_L[current_frame])
|
||||
return next_cond
|
||||
|
||||
else:
|
||||
next_cond = SDXLencode(clip, width, height, crop_w, crop_h, target_width, target_height, cur_prompt_series_G[current_frame], cur_prompt_series_L[current_frame])
|
||||
next_cond = SDXLencode(settings, clip, nxt_prompt_series_G[current_frame], nxt_prompt_series_L[current_frame])
|
||||
return addWeighted(current_cond, next_cond, weight_series[current_frame])
|
||||
+107
-19
@@ -15,22 +15,21 @@ def prompt_schedule(settings:ScheduleSettings,clip):
|
||||
settings.current_frame = settings.current_frame % settings.max_frames
|
||||
|
||||
# clear whitespace and newlines from json
|
||||
animation_prompts = process_input_text(settings.text_G)
|
||||
animation_prompts = process_input_text(settings.text_g)
|
||||
|
||||
# add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G)
|
||||
|
||||
# Interpolate the positive prompt weights over frames
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings)
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings)
|
||||
|
||||
#encode prompts
|
||||
|
||||
# Apply composable diffusion across the batch
|
||||
p = PoolAnimConditioning(pos_cur_prompt[settings.current_frame], pos_nxt_prompt[settings.current_frame],
|
||||
weight[settings.current_frame], clip)
|
||||
|
||||
# Interpolate the negative prompt weights over frames
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings)
|
||||
|
||||
# Apply composable diffusion across the batch
|
||||
n = PoolAnimConditioning(neg_cur_prompt[settings.current_frame], neg_nxt_prompt[settings.current_frame],
|
||||
weight[settings.current_frame], clip)
|
||||
|
||||
@@ -39,21 +38,22 @@ def prompt_schedule(settings:ScheduleSettings,clip):
|
||||
|
||||
def batch_prompt_schedule(settings:ScheduleSettings,clip):
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts = process_input_text(settings.text_G)
|
||||
animation_prompts = process_input_text(settings.text_g)
|
||||
|
||||
# Add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G)
|
||||
|
||||
# Interpolate the positive prompt weights over frames
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings)
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings)
|
||||
|
||||
# encode prompts
|
||||
|
||||
# pad conditionings to largest tensor size
|
||||
|
||||
|
||||
# Apply composable diffusion across the batch
|
||||
p = BatchPoolAnimConditioning(pos_cur_prompt, pos_nxt_prompt, weight, clip, )
|
||||
|
||||
# Interpolate the negative prompt weights over frames
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings)
|
||||
|
||||
# Apply composable diffusion across the batch
|
||||
n = BatchPoolAnimConditioning(neg_cur_prompt, neg_nxt_prompt, weight, clip, )
|
||||
|
||||
# return positive and negative conditioning as well as the current and next prompts for each
|
||||
@@ -61,7 +61,7 @@ def batch_prompt_schedule(settings:ScheduleSettings,clip):
|
||||
|
||||
def batch_prompt_schedule_latentInput(settings:ScheduleSettings,clip, latents):
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts = process_input_text(settings.text_G)
|
||||
animation_prompts = process_input_text(settings.text_g)
|
||||
|
||||
# Add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G)
|
||||
@@ -80,6 +80,101 @@ def batch_prompt_schedule_latentInput(settings:ScheduleSettings,clip, latents):
|
||||
|
||||
return (p, n, latents,)
|
||||
|
||||
def string_schedule(settings:ScheduleSettings):
|
||||
settings.start_frame = 0
|
||||
|
||||
# modulus rollover when current frame exceeds max frames
|
||||
settings.current_frame = settings.current_frame % settings.max_frames
|
||||
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts = process_input_text(settings.text_g)
|
||||
|
||||
# add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G)
|
||||
|
||||
# Interpolate the positive prompt weights over frames
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings)
|
||||
|
||||
# Interpolate the negative prompt weights over frames
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings)
|
||||
|
||||
return(pos_cur_prompt[settings.current_frame], neg_cur_prompt[settings.current_frame], )
|
||||
|
||||
def batch_string_schedule(settings:ScheduleSettings):
|
||||
settings.start_frame = 0
|
||||
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts = process_input_text(settings.text_g)
|
||||
|
||||
# add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G)
|
||||
|
||||
# Interpolate the positive prompt weights over frames
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings)
|
||||
|
||||
# Interpolate the negative prompt weights over frames
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings)
|
||||
|
||||
return (pos_cur_prompt, neg_cur_prompt,)
|
||||
|
||||
def prompt_schedule_SDXL(settings:ScheduleSettings,clip):
|
||||
# modulus rollover when current frame exceeds max frames
|
||||
settings.current_frame = settings.current_frame % settings.max_frames
|
||||
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts_G = process_input_text(settings.text_g)
|
||||
animation_prompts_L = process_input_text(settings.text_l)
|
||||
|
||||
# add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
posG, negG = batch_split_weighted_subprompts(animation_prompts_G, settings.pre_text_G, settings.app_text_G)
|
||||
posL, negL = batch_split_weighted_subprompts(animation_prompts_L, settings.pre_text_L, settings.app_text_L)
|
||||
|
||||
pc, pn, pw, ms = BatchInterpolatePromptsSDXL(posG, posL, clip, settings, )
|
||||
nc, nn, nw, ms = BatchInterpolatePromptsSDXL(negG, negL, clip, settings, )
|
||||
|
||||
#apply composable diffusion to the current frame
|
||||
p = addWeighted(pc[settings.current_frame], pn[settings.current_frame], pw[settings.current_frame])
|
||||
n = addWeighted(nc[settings.current_frame], nn[settings.current_frame], nw[settings.current_frame])
|
||||
|
||||
return (p, n,)
|
||||
|
||||
def batch_prompt_schedule_SDXL(settings:ScheduleSettings,clip):
|
||||
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts_G = process_input_text(settings.text_g)
|
||||
animation_prompts_L = process_input_text(settings.text_l)
|
||||
|
||||
# add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
posG, negG = batch_split_weighted_subprompts(animation_prompts_G, settings.pre_text_G, settings.app_text_G)
|
||||
posL, negL = batch_split_weighted_subprompts(animation_prompts_L, settings.pre_text_L, settings.app_text_L)
|
||||
|
||||
pc, pn, pw, ms = BatchInterpolatePromptsSDXL(posG, posL, clip, settings,)
|
||||
nc, nn, nw, ms = BatchInterpolatePromptsSDXL(negG, negL, clip, settings,)
|
||||
|
||||
p = BatchPoolAnimConditioningSDXL(pc, pn, pw, ms)
|
||||
n = BatchPoolAnimConditioningSDXL(nc, nn, nw, ms)
|
||||
|
||||
return (p, n,)
|
||||
|
||||
def batch_prompt_schedule_SDXL_latentInput(settings:ScheduleSettings,clip, latents):
|
||||
settings.start_frame = 0
|
||||
|
||||
# Clear whitespace and newlines from json
|
||||
animation_prompts_G = process_input_text(settings.text_g)
|
||||
animation_prompts_L = process_input_text(settings.text_l)
|
||||
|
||||
# add pre_text and app_text then split the combined prompt into positive and negative prompts
|
||||
posG, negG = batch_split_weighted_subprompts(animation_prompts_G, settings.pre_text_G, settings.app_text_G)
|
||||
posL, negL = batch_split_weighted_subprompts(animation_prompts_L, settings.pre_text_L, settings.app_text_L)
|
||||
|
||||
pc, pn, pw, ms = BatchInterpolatePromptsSDXL(posG, posL, clip, settings)
|
||||
nc, nn, nw, ms = BatchInterpolatePromptsSDXL(negG, negL, clip, settings)
|
||||
|
||||
p = BatchPoolAnimConditioningSDXL(pc, pn, pw, ms)
|
||||
n = BatchPoolAnimConditioningSDXL(nc, nn, nw, ms)
|
||||
|
||||
return (p, n, latents,)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -92,13 +187,6 @@ def batch_prompt_schedule_latentInput(settings:ScheduleSettings,clip, latents):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+333
-289
@@ -51,28 +51,31 @@ defaultValue="""0:(0),
|
||||
class PromptSchedule:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"text": ("STRING", {"multiline": True, "default":defaultPrompt}),
|
||||
"clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0, "forceInput": True }),
|
||||
"print_output":("BOOLEAN", {"default": False,}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}}
|
||||
return {"required": {
|
||||
"text": ("STRING", {"multiline": True, "default":defaultPrompt}),
|
||||
"clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0, "forceInput": True }),
|
||||
"print_output":("BOOLEAN", {"default": False,}),
|
||||
},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG",)
|
||||
FUNCTION = "animate"
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/ScheduleNodes"
|
||||
|
||||
def animate(self, text, max_frames, print_output, current_frame,clip, pw_a, pw_b, pw_c, pw_d, pre_text='', app_text=''
|
||||
def animate(self, text, max_frames, print_output, current_frame,clip, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text=''
|
||||
):
|
||||
settings = ScheduleSettings(
|
||||
text_G=text,
|
||||
text_g=text,
|
||||
pre_text_G=pre_text,
|
||||
app_text_G=app_text,
|
||||
text_L=None,
|
||||
@@ -103,19 +106,22 @@ class PromptSchedule:
|
||||
class BatchPromptSchedule:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"clip": ("CLIP",),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False}),},
|
||||
# "forceInput": True}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"start_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1, }),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
}}
|
||||
return {"required": {
|
||||
"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"clip": ("CLIP",),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"start_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1, }),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG",)
|
||||
@@ -123,10 +129,10 @@ class BatchPromptSchedule:
|
||||
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
|
||||
|
||||
def animate(self, text, max_frames, print_output, clip, start_frame, pw_a, pw_b, pw_c, pw_d, pre_text='', app_text=''
|
||||
def animate(self, text, max_frames, print_output, clip, start_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text=''
|
||||
):
|
||||
settings = ScheduleSettings(
|
||||
text_G=text,
|
||||
text_g=text,
|
||||
pre_text_G=pre_text,
|
||||
app_text_G=app_text,
|
||||
text_L=None,
|
||||
@@ -160,29 +166,32 @@ class BatchPromptSchedule:
|
||||
class BatchPromptScheduleLatentInput:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"clip": ("CLIP",),
|
||||
"num_latents": ("LATENT", ),
|
||||
"print_output":("BOOLEAN", {"default": False, "forceInput": True}),},
|
||||
return {"required": {
|
||||
"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"clip": ("CLIP",),
|
||||
"num_latents": ("LATENT", ),
|
||||
"print_output":("BOOLEAN", {"default": False, "forceInput": True}),
|
||||
},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"start_frame": ("INT", {"default": 0.0, "min": 0, "max": 9999, "step": 1, }),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}}
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"start_frame": ("INT", {"default": 0.0, "min": 0, "max": 9999, "step": 1, }),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT", "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG", "INPUT_LATENTS", "POS_CUR", "NEG_CUR", "POS_NXT", "NEG_NXT",)
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT",) #"CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG", "INPUT_LATENTS", ) #"POS_CUR", "NEG_CUR", "POS_NXT", "NEG_NXT",)
|
||||
FUNCTION = "animate"
|
||||
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
|
||||
|
||||
def animate(self, text, num_latents, print_output, clip, start_frame, pw_a, pw_b, pw_c, pw_d, pre_text='', app_text=''
|
||||
def animate(self, text, num_latents, print_output, clip, start_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text=''
|
||||
):
|
||||
settings = ScheduleSettings(
|
||||
text_G=text,
|
||||
text_g=text,
|
||||
pre_text_G=pre_text,
|
||||
app_text_G=app_text,
|
||||
text_L=None,
|
||||
@@ -209,21 +218,17 @@ class StringSchedule:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0, }),
|
||||
"print_output":("BOOLEAN", {"default": False}),},
|
||||
# "forceInput": True}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, }), # "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, }), # "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
}}
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0, }),
|
||||
"print_output":("BOOLEAN", {"default": False}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "STRING",)
|
||||
RETURN_NAMES = ("POS", "NEG",)
|
||||
@@ -232,40 +237,47 @@ class StringSchedule:
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/ScheduleNodes"
|
||||
|
||||
def animate(self, text, max_frames, current_frame, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='', print_output = False ):
|
||||
current_frame = current_frame % max_frames
|
||||
inputText = str("{" + text + "}")
|
||||
inputText = re.sub(r',\s*}', '}', inputText)
|
||||
animation_prompts = json.loads(inputText.strip())
|
||||
start_frame = 0
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, pre_text, app_text)
|
||||
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_series(pos, max_frames, 0, pre_text,
|
||||
app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_series(neg, max_frames, start_frame, pre_text,
|
||||
app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
return(pos_cur_prompt[current_frame], neg_cur_prompt[current_frame], )
|
||||
settings = ScheduleSettings(
|
||||
text_g = text,
|
||||
pre_text_G = pre_text,
|
||||
app_text_G = app_text,
|
||||
text_L = None,
|
||||
pre_text_L = None,
|
||||
app_text_L = None,
|
||||
max_frames = max_frames,
|
||||
current_frame = current_frame,
|
||||
print_output = print_output,
|
||||
pw_a = pw_a,
|
||||
pw_b = pw_b,
|
||||
pw_c = pw_c,
|
||||
pw_d = pw_d,
|
||||
start_frame = 0,
|
||||
width = None,
|
||||
height = None,
|
||||
crop_w = None,
|
||||
crop_h = None,
|
||||
target_width = None,
|
||||
target_height = None,
|
||||
)
|
||||
return string_schedule(settings)
|
||||
|
||||
class BatchStringSchedule:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output": ("BOOLEAN", {"default": False}),},
|
||||
# "forceInput": True}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, }), # "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, }), # "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
}}
|
||||
return {"required": {
|
||||
"text": ("STRING", {"multiline": True, "default": defaultPrompt}),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "STRING",)
|
||||
RETURN_NAMES = ("POS", "NEG",)
|
||||
@@ -273,151 +285,175 @@ class BatchStringSchedule:
|
||||
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
|
||||
|
||||
def animate(self, text, max_frames, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='', print_output=False):
|
||||
inputText = str("{" + text + "}")
|
||||
inputText = re.sub(r',\s*}', '}', inputText)
|
||||
start_frame = 0
|
||||
animation_prompts = json.loads(inputText.strip())
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, pre_text, app_text)
|
||||
def animate(self, text, max_frames, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', app_text='',
|
||||
print_output=False):
|
||||
settings = ScheduleSettings(
|
||||
text_g=text,
|
||||
pre_text_G=pre_text,
|
||||
app_text_G=app_text,
|
||||
text_L=None,
|
||||
pre_text_L=None,
|
||||
app_text_L=None,
|
||||
max_frames=max_frames,
|
||||
current_frame=None,
|
||||
print_output=print_output,
|
||||
pw_a=pw_a,
|
||||
pw_b=pw_b,
|
||||
pw_c=pw_c,
|
||||
pw_d=pw_d,
|
||||
start_frame=0,
|
||||
width=None,
|
||||
height=None,
|
||||
crop_w=None,
|
||||
crop_h=None,
|
||||
target_width=None,
|
||||
target_height=None,
|
||||
)
|
||||
return batch_string_schedule(settings)
|
||||
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_series(pos, max_frames, start_frame, pre_text,
|
||||
app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_series(neg, max_frames, start_frame, pre_text,
|
||||
app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
|
||||
|
||||
|
||||
return (pos_cur_prompt, neg_cur_prompt, )
|
||||
|
||||
class BatchPromptScheduleEncodeSDXL:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"text_g": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"text_l": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False}),},
|
||||
"optional": {"pre_text_G": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"app_text_G": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"pre_text_L": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"app_text_L": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
}}
|
||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"text_g": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"text_l": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"pre_text_G": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text_G": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pre_text_L": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text_L": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING",)# "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG", "POS_CUR", "NEG_CUR", "POS_NXT", "NEG_NXT",)
|
||||
FUNCTION = "animate"
|
||||
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
|
||||
|
||||
def animate(self, clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l, app_text_G, app_text_L, pre_text_G, pre_text_L, max_frames, print_output, pw_a, pw_b, pw_c, pw_d):
|
||||
inputTextG = str("{" + text_g + "}")
|
||||
inputTextL = str("{" + text_l + "}")
|
||||
inputTextG = re.sub(r',\s*}', '}', inputTextG)
|
||||
inputTextL = re.sub(r',\s*}', '}', inputTextL)
|
||||
animation_promptsG = json.loads(inputTextG.strip())
|
||||
animation_promptsL = json.loads(inputTextL.strip())
|
||||
posG, negG = batch_split_weighted_subprompts(animation_promptsG, pre_text_G, app_text_G)
|
||||
posL, negL = batch_split_weighted_subprompts(animation_promptsL, pre_text_L, app_text_L)
|
||||
pc, pn, pw, ms = BatchInterpolatePromptsSDXL(posG, posL, max_frames, clip, app_text_G, app_text_L, pre_text_G,
|
||||
pre_text_L, pw_a, pw_b, pw_c, pw_d, width, height, crop_w, crop_h,
|
||||
target_width, target_height, print_output, )
|
||||
p = BatchPoolAnimConditioningSDXL(pc, pn, pw, ms)
|
||||
|
||||
nc, nn, nw, ms = BatchInterpolatePromptsSDXL(negG, negL, max_frames, clip, app_text_G,
|
||||
app_text_L, pre_text_G, pre_text_L, pw_a, pw_b, pw_c, pw_d, width,
|
||||
height, crop_w, crop_h, target_width, target_height, print_output, )
|
||||
n = BatchPoolAnimConditioningSDXL(nc, nn, nw, ms)
|
||||
|
||||
return (p,n,pc,pn,nc,nn,)
|
||||
def animate(self, clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l, app_text_G, app_text_L, pre_text_G, pre_text_L, max_frames, print_output, pw_a=0, pw_b=0, pw_c=0, pw_d=0):
|
||||
settings = ScheduleSettings(
|
||||
text_g=text_g,
|
||||
pre_text_G=pre_text_G,
|
||||
app_text_G=app_text_G,
|
||||
text_L=text_l,
|
||||
pre_text_L=pre_text_L,
|
||||
app_text_L=app_text_L,
|
||||
max_frames=max_frames,
|
||||
current_frame=None,
|
||||
print_output=print_output,
|
||||
pw_a=pw_a,
|
||||
pw_b=pw_b,
|
||||
pw_c=pw_c,
|
||||
pw_d=pw_d,
|
||||
start_frame=0,
|
||||
width=width,
|
||||
height=height,
|
||||
crop_w=crop_w,
|
||||
crop_h=crop_h,
|
||||
target_width=target_width,
|
||||
target_height=target_height,
|
||||
)
|
||||
return batch_prompt_schedule_SDXL(settings, clip)
|
||||
|
||||
class BatchPromptScheduleEncodeSDXLLatentInput:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"text_g": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"text_l": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"num_latents": ("LATENT", ),
|
||||
"print_output":("BOOLEAN", {"default": False}),},
|
||||
"optional": {"pre_text_G": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"app_text_G": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"pre_text_L": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"app_text_L": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
}}
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT", "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"text_g": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"text_l": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"num_latents": ("LATENT", ),
|
||||
"print_output":("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"pre_text_G": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text_G": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pre_text_L": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text_L": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT",)# "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG", "POS_CUR", "NEG_CUR", "POS_NXT", "NEG_NXT",)
|
||||
FUNCTION = "animate"
|
||||
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
|
||||
|
||||
def animate(self, clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l, app_text_G, app_text_L, pre_text_G, pre_text_L, num_latents, print_output, pw_a, pw_b, pw_c, pw_d):
|
||||
max_frames = sum(tensor.size(0) for tensor in num_latents.values())
|
||||
inputTextG = str("{" + text_g + "}")
|
||||
inputTextL = str("{" + text_l + "}")
|
||||
inputTextG = re.sub(r',\s*}', '}', inputTextG)
|
||||
inputTextL = re.sub(r',\s*}', '}', inputTextL)
|
||||
animation_promptsG = json.loads(inputTextG.strip())
|
||||
animation_promptsL = json.loads(inputTextL.strip())
|
||||
posG, negG = batch_split_weighted_subprompts(animation_promptsG, pre_text_G, app_text_G)
|
||||
posL, negL = batch_split_weighted_subprompts(animation_promptsL, pre_text_L, app_text_L)
|
||||
pc, pn, pw, ms = BatchInterpolatePromptsSDXL(posG, posL, max_frames, clip, app_text_G, app_text_L, pre_text_G,
|
||||
pre_text_L, pw_a, pw_b, pw_c, pw_d, width, height, crop_w, crop_h,
|
||||
target_width, target_height, print_output, )
|
||||
p = BatchPoolAnimConditioningSDXL(pc, pn, pw, ms)
|
||||
|
||||
nc, nn, nw, ms = BatchInterpolatePromptsSDXL(negG, negL, max_frames, clip, app_text_G,
|
||||
app_text_L, pre_text_G, pre_text_L, pw_a, pw_b, pw_c, pw_d, width,
|
||||
height, crop_w, crop_h, target_width, target_height, print_output, )
|
||||
n = BatchPoolAnimConditioningSDXL(nc, nn, nw, ms)
|
||||
|
||||
return (p,n,num_latents,pc,pn,nc,nn,)
|
||||
settings = ScheduleSettings(
|
||||
text_g=text_g,
|
||||
pre_text_G=pre_text_G,
|
||||
app_text_G=app_text_G,
|
||||
text_L=text_l,
|
||||
pre_text_L=pre_text_L,
|
||||
app_text_L=app_text_L,
|
||||
max_frames=sum(tensor.size(0) for tensor in num_latents.values()),
|
||||
current_frame=None,
|
||||
print_output=print_output,
|
||||
pw_a=pw_a,
|
||||
pw_b=pw_b,
|
||||
pw_c=pw_c,
|
||||
pw_d=pw_d,
|
||||
start_frame=0,
|
||||
width=width,
|
||||
height=height,
|
||||
crop_w=crop_w,
|
||||
crop_h=crop_h,
|
||||
target_width=target_width,
|
||||
target_height=target_height,
|
||||
)
|
||||
return batch_prompt_schedule_SDXL_latentInput(settings, clip, num_latents)
|
||||
|
||||
class PromptScheduleEncodeSDXL:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"text_g": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"text_l": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False})},
|
||||
"optional": {"pre_text_G": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"app_text_G": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"pre_text_L": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"app_text_L": ("STRING", {"multiline": True, }),# "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}), #"forceInput": True }),
|
||||
}}
|
||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||
"text_g": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"text_l": ("STRING", {"multiline": True, }), "clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False})
|
||||
},
|
||||
"optional": {
|
||||
"pre_text_G": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text_G": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pre_text_L": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text_L": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("CONDITIONING","CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG",)
|
||||
FUNCTION = "animate"
|
||||
@@ -425,25 +461,29 @@ class PromptScheduleEncodeSDXL:
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/ScheduleNodes"
|
||||
|
||||
def animate(self, clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l, app_text_G, app_text_L, pre_text_G, pre_text_L, max_frames, current_frame, print_output, pw_a, pw_b, pw_c, pw_d):
|
||||
current_frame = current_frame % max_frames
|
||||
inputTextG = str("{" + text_g + "}")
|
||||
inputTextL = str("{" + text_l + "}")
|
||||
inputTextG = re.sub(r',\s*}', '}', inputTextG)
|
||||
inputTextL = re.sub(r',\s*}', '}', inputTextL)
|
||||
animation_promptsG = json.loads(inputTextG.strip())
|
||||
animation_promptsL = json.loads(inputTextL.strip())
|
||||
posG, negG = batch_split_weighted_subprompts(animation_promptsG, pre_text_G, app_text_G)
|
||||
posL, negL = batch_split_weighted_subprompts(animation_promptsL, pre_text_L, app_text_L)
|
||||
|
||||
pc,pn,pw = BatchInterpolatePromptsSDXL(posG, posL, max_frames, clip, app_text_G, app_text_L, pre_text_G, pre_text_L, pw_a, pw_b, pw_c, pw_d, width, height, crop_w, crop_h, target_width, target_height, print_output,)
|
||||
p = addWeighted(pc[current_frame], pn[current_frame], pw[current_frame])
|
||||
|
||||
nc, nn, nw = BatchInterpolatePromptsSDXL(negG, negL, max_frames, clip, app_text_G,
|
||||
app_text_L, pre_text_G, pre_text_L, pw_a, pw_b, pw_c, pw_d, width,
|
||||
height, crop_w, crop_h, target_width, target_height, print_output, )
|
||||
n = addWeighted(nc[current_frame], nn[current_frame], nw[current_frame])
|
||||
|
||||
return (p,n,)
|
||||
settings = ScheduleSettings(
|
||||
text_g=text_g,
|
||||
pre_text_G=pre_text_G,
|
||||
app_text_G=app_text_G,
|
||||
text_L=text_l,
|
||||
pre_text_L=pre_text_L,
|
||||
app_text_L=app_text_L,
|
||||
max_frames=max_frames,
|
||||
current_frame=current_frame,
|
||||
print_output=print_output,
|
||||
pw_a=pw_a,
|
||||
pw_b=pw_b,
|
||||
pw_c=pw_c,
|
||||
pw_d=pw_d,
|
||||
start_frame=0,
|
||||
width=width,
|
||||
height=height,
|
||||
crop_w=crop_w,
|
||||
crop_h=crop_h,
|
||||
target_width=target_width,
|
||||
target_height=target_height,
|
||||
)
|
||||
return prompt_schedule_SDXL(settings,clip)
|
||||
|
||||
# This node schedules the prompt using separate nodes as the keyframes.
|
||||
# The values in the prompt are evaluated in NodeFlowEnd.
|
||||
@@ -453,7 +493,7 @@ class PromptScheduleNodeFlow:
|
||||
return {"required": {"text": ("STRING", {"multiline": True}),
|
||||
"num_frames": ("INT", {"default": 24.0, "min": 0.0, "max": 9999.0, "step": 1.0}),},
|
||||
"optional": {"in_text": ("STRING", {"multiline": False, }), # "forceInput": True}),
|
||||
"max_frames": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0,})}} # "forceInput": True}),}}
|
||||
"max_frames": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0,})}}
|
||||
|
||||
RETURN_TYPES = ("INT","STRING",)
|
||||
FUNCTION = "addString"
|
||||
@@ -486,13 +526,13 @@ class PromptScheduleNodeFlowEnd:
|
||||
"clip": ("CLIP", ),
|
||||
"max_frames": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0,}),
|
||||
"print_output": ("BOOLEAN", {"default": False}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0,}),}, #"forceInput": True}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, }),#"forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, }),#"forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0, "forceInput": True}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
}}
|
||||
RETURN_TYPES = ("CONDITIONING","CONDITIONING",)
|
||||
RETURN_NAMES = ("POS", "NEG",)
|
||||
@@ -501,29 +541,33 @@ class PromptScheduleNodeFlowEnd:
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/ScheduleNodes"
|
||||
|
||||
def animate(self, text, max_frames, print_output, current_frame, clip, pw_a = 0, pw_b = 0, pw_c = 0, pw_d = 0, pre_text = '', app_text = ''):
|
||||
current_frame = current_frame % max_frames
|
||||
if text[-1] == ",":
|
||||
text = text[:-1]
|
||||
if text[0] == ",":
|
||||
text = text[:0]
|
||||
start_frame = 0
|
||||
inputText = str("{" + text + "}")
|
||||
inputText = re.sub(r',\s*}', '}', inputText)
|
||||
animation_prompts = json.loads(inputText.strip())
|
||||
max_frames += start_frame
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, pre_text, app_text)
|
||||
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_series(pos, max_frames, start_frame, pre_text, app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
pc = PoolAnimConditioning(pos_cur_prompt[current_frame], pos_nxt_prompt[current_frame], weight[current_frame],
|
||||
clip, )
|
||||
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_series(neg, max_frames, start_frame, pre_text, app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
nc = PoolAnimConditioning(neg_cur_prompt[current_frame], neg_nxt_prompt[current_frame], weight[current_frame],
|
||||
clip, )
|
||||
|
||||
return (pc, nc,)
|
||||
settings = ScheduleSettings(
|
||||
text_g=text,
|
||||
pre_text_G=pre_text,
|
||||
app_text_G=app_text,
|
||||
text_L=None,
|
||||
pre_text_L=None,
|
||||
app_text_L=None,
|
||||
max_frames=max_frames,
|
||||
current_frame=current_frame,
|
||||
print_output=print_output,
|
||||
pw_a=pw_a,
|
||||
pw_b=pw_b,
|
||||
pw_c=pw_c,
|
||||
pw_d=pw_d,
|
||||
start_frame=0,
|
||||
width=None,
|
||||
height=None,
|
||||
crop_w=None,
|
||||
crop_h=None,
|
||||
target_width=None,
|
||||
target_height=None,
|
||||
)
|
||||
return prompt_schedule(settings, clip)
|
||||
|
||||
class BatchPromptScheduleNodeFlowEnd:
|
||||
@classmethod
|
||||
@@ -533,12 +577,12 @@ class BatchPromptScheduleNodeFlowEnd:
|
||||
"max_frames": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0,}),
|
||||
"print_output": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": False, }),#"forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": False, }),#"forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1,}),# "forceInput": True}),
|
||||
"optional": {"pre_text": ("STRING", {"multiline": False, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": False, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING", "CONDITIONING",)
|
||||
@@ -548,31 +592,35 @@ class BatchPromptScheduleNodeFlowEnd:
|
||||
|
||||
CATEGORY = "FizzNodes 📅🅕🅝/BatchScheduleNodes"
|
||||
|
||||
def animate(self, text, max_frames, start_frame, print_output, clip, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='', current_frame = 0,
|
||||
def animate(self, text, max_frames, start_frame, print_output, clip, pw_a=0, pw_b=0, pw_c=0, pw_d=0, pre_text='',
|
||||
app_text=''):
|
||||
if text[-1] == ",":
|
||||
text = text[:-1]
|
||||
if text[0] == ",":
|
||||
text = text[:0]
|
||||
inputText = str("{" + text + "}")
|
||||
inputText = re.sub(r',\s*}', '}', inputText)
|
||||
animation_prompts = json.loads(inputText.strip())
|
||||
|
||||
max_frames += start_frame
|
||||
|
||||
pos, neg = batch_split_weighted_subprompts(animation_prompts, pre_text, app_text)
|
||||
|
||||
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_series(pos, max_frames, start_frame, pre_text, app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
pc = BatchPoolAnimConditioning(pos_cur_prompt[current_frame], pos_nxt_prompt[current_frame], weight[current_frame],
|
||||
clip, )
|
||||
|
||||
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_series(neg, max_frames, start_frame, pre_text, app_text, pw_a,
|
||||
pw_b, pw_c, pw_d, print_output)
|
||||
nc = BatchPoolAnimConditioning(neg_cur_prompt[current_frame], neg_nxt_prompt[current_frame], weight[current_frame],
|
||||
clip, )
|
||||
|
||||
return (pc, nc, pos_cur_prompt, pos_nxt_prompt, neg_cur_prompt, neg_nxt_prompt, )
|
||||
settings = ScheduleSettings(
|
||||
text_g=text,
|
||||
pre_text_G=pre_text,
|
||||
app_text_G=app_text,
|
||||
text_L=None,
|
||||
pre_text_L=None,
|
||||
app_text_L=None,
|
||||
max_frames=max_frames,
|
||||
current_frame=None,
|
||||
print_output=print_output,
|
||||
pw_a=pw_a,
|
||||
pw_b=pw_b,
|
||||
pw_c=pw_c,
|
||||
pw_d=pw_d,
|
||||
start_frame=start_frame,
|
||||
width=None,
|
||||
height=None,
|
||||
crop_w=None,
|
||||
crop_h=None,
|
||||
target_width=None,
|
||||
target_height=None,
|
||||
)
|
||||
return batch_prompt_schedule(settings, clip)
|
||||
|
||||
class BatchGLIGENSchedule:
|
||||
@classmethod
|
||||
@@ -588,16 +636,12 @@ class BatchGLIGENSchedule:
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"print_output":("BOOLEAN", {"default": False})},
|
||||
# "forceInput": True}),},
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, }), # "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, }), # "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, }),
|
||||
# "forceInput": True }),
|
||||
"optional": {"pre_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"app_text": ("STRING", {"multiline": True, "forceInput": True}),
|
||||
"pw_a": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_b": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_c": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
"pw_d": ("FLOAT", {"default": 0.0, "min": -9999.0, "max": 9999.0, "step": 0.1, "forceInput": True }),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("CONDITIONING",)
|
||||
@@ -648,7 +692,7 @@ class ValueSchedule:
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"text": ("STRING", {"multiline": True, "default":defaultValue}),
|
||||
"max_frames": ("INT", {"default": 120.0, "min": 1.0, "max": 999999.0, "step": 1.0}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0,}),# "forceInput": True}),
|
||||
"current_frame": ("INT", {"default": 0.0, "min": 0.0, "max": 999999.0, "step": 1.0, "forceInput": True}),
|
||||
"print_output": ("BOOLEAN", {"default": False})}}
|
||||
RETURN_TYPES = ("FLOAT", "INT")
|
||||
FUNCTION = "animate"
|
||||
|
||||
Reference in New Issue
Block a user