|
|
import comfy |
|
|
import numexpr |
|
|
import torch |
|
|
import numpy as np |
|
|
import pandas as pd |
|
|
import re |
|
|
import json |
|
|
|
|
|
from .ScheduleFuncs import * |
|
|
from .BatchFuncs import * |
|
|
|
|
|
def prompt_schedule(settings:ScheduleSettings,clip): |
|
|
settings.start_frame = 0 |
|
|
|
|
|
settings.current_frame = settings.current_frame % settings.max_frames |
|
|
|
|
|
|
|
|
animation_prompts = process_input_text(settings.text_g) |
|
|
|
|
|
|
|
|
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G) |
|
|
|
|
|
|
|
|
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings) |
|
|
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings) |
|
|
|
|
|
|
|
|
p = PoolAnimConditioning(pos_cur_prompt[settings.current_frame], pos_nxt_prompt[settings.current_frame], |
|
|
weight[settings.current_frame], clip) |
|
|
|
|
|
n = PoolAnimConditioning(neg_cur_prompt[settings.current_frame], neg_nxt_prompt[settings.current_frame], |
|
|
weight[settings.current_frame], clip) |
|
|
|
|
|
|
|
|
return (p, n,) |
|
|
|
|
|
def batch_prompt_schedule(settings:ScheduleSettings,clip): |
|
|
|
|
|
animation_prompts = process_input_text(settings.text_g) |
|
|
|
|
|
|
|
|
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G) |
|
|
|
|
|
|
|
|
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings) |
|
|
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings) |
|
|
|
|
|
|
|
|
p = BatchPoolAnimConditioning(pos_cur_prompt, pos_nxt_prompt, weight, clip, settings) |
|
|
n = BatchPoolAnimConditioning(neg_cur_prompt, neg_nxt_prompt, weight, clip, settings) |
|
|
|
|
|
|
|
|
return (p, n,) |
|
|
|
|
|
def batch_prompt_schedule_latentInput(settings:ScheduleSettings,clip, latents): |
|
|
|
|
|
animation_prompts = process_input_text(settings.text_g) |
|
|
|
|
|
|
|
|
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G) |
|
|
|
|
|
|
|
|
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings) |
|
|
|
|
|
|
|
|
p = BatchPoolAnimConditioning(pos_cur_prompt, pos_nxt_prompt, weight, clip, settings) |
|
|
|
|
|
|
|
|
neg_cur_prompt, neg_nxt_prompt, weight = interpolate_prompt_seriesA(neg, settings) |
|
|
|
|
|
|
|
|
n = BatchPoolAnimConditioning(neg_cur_prompt, neg_nxt_prompt, weight, clip, settings) |
|
|
|
|
|
return (p, n, latents,) |
|
|
|
|
|
def string_schedule(settings:ScheduleSettings): |
|
|
settings.start_frame = 0 |
|
|
|
|
|
|
|
|
settings.current_frame = settings.current_frame % settings.max_frames |
|
|
|
|
|
|
|
|
animation_prompts = process_input_text(settings.text_g) |
|
|
|
|
|
|
|
|
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G) |
|
|
|
|
|
|
|
|
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings) |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
animation_prompts = process_input_text(settings.text_g) |
|
|
|
|
|
|
|
|
pos, neg = batch_split_weighted_subprompts(animation_prompts, settings.pre_text_G, settings.app_text_G) |
|
|
|
|
|
|
|
|
pos_cur_prompt, pos_nxt_prompt, weight = interpolate_prompt_seriesA(pos, settings) |
|
|
|
|
|
|
|
|
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): |
|
|
|
|
|
settings.current_frame = settings.current_frame % settings.max_frames |
|
|
|
|
|
|
|
|
animation_prompts_G = process_input_text(settings.text_g) |
|
|
animation_prompts_L = process_input_text(settings.text_l) |
|
|
|
|
|
|
|
|
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 = BatchInterpolatePromptsSDXL(posG, posL, clip, settings, ) |
|
|
nc, nn, nw = BatchInterpolatePromptsSDXL(negG, negL, clip, settings, ) |
|
|
|
|
|
|
|
|
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): |
|
|
|
|
|
|
|
|
animation_prompts_G = process_input_text(settings.text_g) |
|
|
animation_prompts_L = process_input_text(settings.text_l) |
|
|
|
|
|
|
|
|
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 = BatchInterpolatePromptsSDXL(posG, posL, clip, settings,) |
|
|
nc, nn, nw = BatchInterpolatePromptsSDXL(negG, negL, clip, settings,) |
|
|
|
|
|
p = BatchPoolAnimConditioningSDXL(pc, pn, pw, clip, settings) |
|
|
n = BatchPoolAnimConditioningSDXL(nc, nn, nw, clip, settings) |
|
|
|
|
|
return (p, n,) |
|
|
|
|
|
def batch_prompt_schedule_SDXL_latentInput(settings:ScheduleSettings,clip, latents): |
|
|
settings.start_frame = 0 |
|
|
|
|
|
|
|
|
animation_prompts_G = process_input_text(settings.text_g) |
|
|
animation_prompts_L = process_input_text(settings.text_l) |
|
|
|
|
|
|
|
|
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 = BatchInterpolatePromptsSDXL(posG, posL, clip, settings) |
|
|
nc, nn, nw = BatchInterpolatePromptsSDXL(negG, negL, clip, settings) |
|
|
|
|
|
p = BatchPoolAnimConditioningSDXL(pc, pn, pw, clip, settings) |
|
|
n = BatchPoolAnimConditioningSDXL(nc, nn, nw, clip, settings) |
|
|
|
|
|
return (p, n, latents,) |
|
|
|
|
|
def prompt_schedule_SD3(settings:ScheduleSettings,clip): |
|
|
|
|
|
settings.current_frame = settings.current_frame % settings.max_frames |
|
|
|
|
|
|
|
|
animation_prompts_G = process_input_text(settings.text_g) |
|
|
animation_prompts_L = process_input_text(settings.text_l) |
|
|
animation_prompts_T = process_input_text(settings.text_l) |
|
|
|
|
|
|
|
|
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) |
|
|
posT, negT = batch_split_weighted_subprompts(animation_prompts_L, settings.pre_text_L, settings.app_text_L) |
|
|
|
|
|
pc, pn, pw = BatchInterpolatePromptsSD3(posG, posL, clip, settings, ) |
|
|
nc, nn, nw = BatchInterpolatePromptsSD3(negG, negL, clip, settings, ) |
|
|
|
|
|
|
|
|
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_SD3(settings:ScheduleSettings,clip): |
|
|
|
|
|
|
|
|
animation_prompts_G = process_input_text(settings.text_g) |
|
|
animation_prompts_L = process_input_text(settings.text_l) |
|
|
animation_prompts_T = process_input_text(settings.text_l) |
|
|
|
|
|
|
|
|
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) |
|
|
posT, negT = batch_split_weighted_subprompts(animation_prompts_L, settings.pre_text_L, settings.app_text_L) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (p, n,) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|