Fixing conflicts
This commit is contained in:
+34
-34
@@ -7,22 +7,22 @@ import comfy.controlnet as comfy_cn
|
||||
from comfy.controlnet import ControlNet, T2IAdapter, broadcast_image_to
|
||||
|
||||
|
||||
ControlNetWeightsType = list[float]
|
||||
T2IAdapterWeightsType = list[float]
|
||||
ControlNetWeightsTypeImport = list[float]
|
||||
T2IAdapterWeightsTypeImport = list[float]
|
||||
|
||||
|
||||
class LatentKeyframe:
|
||||
class LatentKeyframeImport:
|
||||
def __init__(self, batch_index: int, strength: float) -> None:
|
||||
self.batch_index = batch_index
|
||||
self.strength = strength
|
||||
|
||||
|
||||
# always maintain sorted state (by batch_index of LatentKeyframe)
|
||||
class LatentKeyframeGroup:
|
||||
class LatentKeyframeGroupImport:
|
||||
def __init__(self) -> None:
|
||||
self.keyframes: list[LatentKeyframe] = []
|
||||
self.keyframes: list[LatentKeyframeImport] = []
|
||||
|
||||
def add(self, keyframe: LatentKeyframe) -> None:
|
||||
def add(self, keyframe: LatentKeyframeImport) -> None:
|
||||
added = False
|
||||
# replace existing keyframe if same batch_index
|
||||
for i in range(len(self.keyframes)):
|
||||
@@ -34,25 +34,25 @@ class LatentKeyframeGroup:
|
||||
self.keyframes.append(keyframe)
|
||||
self.keyframes.sort(key=lambda k: k.batch_index)
|
||||
|
||||
def get_index(self, index: int) -> Union[LatentKeyframe, None]:
|
||||
def get_index(self, index: int) -> Union[LatentKeyframeImport, None]:
|
||||
try:
|
||||
return self.keyframes[index]
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
def __getitem__(self, index) -> LatentKeyframe:
|
||||
def __getitem__(self, index) -> LatentKeyframeImport:
|
||||
return self.keyframes[index]
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
return len(self.keyframes) == 0
|
||||
|
||||
|
||||
class TimestepKeyframe:
|
||||
class TimestepKeyframeImport:
|
||||
def __init__(self,
|
||||
start_percent: float = 0.0,
|
||||
control_net_weights: ControlNetWeightsType = None,
|
||||
t2i_adapter_weights: T2IAdapterWeightsType = None,
|
||||
latent_keyframes: LatentKeyframeGroup = None,
|
||||
control_net_weights: ControlNetWeightsTypeImport = None,
|
||||
t2i_adapter_weights: T2IAdapterWeightsTypeImport = None,
|
||||
latent_keyframes: LatentKeyframeGroupImport = None,
|
||||
default_latent_strength: float = 0.0) -> None:
|
||||
self.start_percent = start_percent
|
||||
self.control_net_weights = control_net_weights
|
||||
@@ -62,17 +62,17 @@ class TimestepKeyframe:
|
||||
|
||||
|
||||
@classmethod
|
||||
def default(cls) -> 'TimestepKeyframe':
|
||||
def default(cls) -> 'TimestepKeyframeImport':
|
||||
return cls(0.0)
|
||||
|
||||
|
||||
# always maintain sorted state (by start_percent of TimestepKeyFrame)
|
||||
class TimestepKeyframeGroup:
|
||||
class TimestepKeyframeGroupImport:
|
||||
def __init__(self) -> None:
|
||||
self.keyframes: list[TimestepKeyframe] = []
|
||||
self.keyframes.append(TimestepKeyframe.default())
|
||||
self.keyframes: list[TimestepKeyframeImport] = []
|
||||
self.keyframes.append(TimestepKeyframeImport.default())
|
||||
|
||||
def add(self, keyframe: TimestepKeyframe) -> None:
|
||||
def add(self, keyframe: TimestepKeyframeImport) -> None:
|
||||
added = False
|
||||
# replace existing keyframe if same start_percent
|
||||
for i in range(len(self.keyframes)):
|
||||
@@ -84,20 +84,20 @@ class TimestepKeyframeGroup:
|
||||
self.keyframes.append(keyframe)
|
||||
self.keyframes.sort(key=lambda k: k.start_percent)
|
||||
|
||||
def get_index(self, index: int) -> Union[TimestepKeyframe, None]:
|
||||
def get_index(self, index: int) -> Union[TimestepKeyframeImport, None]:
|
||||
try:
|
||||
return self.keyframes[index]
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
def __getitem__(self, index) -> TimestepKeyframe:
|
||||
def __getitem__(self, index) -> TimestepKeyframeImport:
|
||||
return self.keyframes[index]
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
return len(self.keyframes) == 0
|
||||
|
||||
@classmethod
|
||||
def default(cls, keyframe: TimestepKeyframe) -> 'TimestepKeyframeGroup':
|
||||
def default(cls, keyframe: TimestepKeyframeImport) -> 'TimestepKeyframeGroupImport':
|
||||
group = cls()
|
||||
group.keyframes[0] = keyframe
|
||||
return group
|
||||
@@ -154,11 +154,11 @@ def control_merge_inject(self, control_input, control_output, control_prev, outp
|
||||
return out
|
||||
|
||||
|
||||
class ControlNetAdvanced(ControlNet):
|
||||
def __init__(self, control_model, timestep_keyframes: TimestepKeyframeGroup, global_average_pooling=False, device=None):
|
||||
class ControlNetAdvancedImport(ControlNet):
|
||||
def __init__(self, control_model, timestep_keyframes: TimestepKeyframeGroupImport, global_average_pooling=False, device=None):
|
||||
super().__init__(control_model=control_model, global_average_pooling=global_average_pooling, device=device)
|
||||
# initialize timestep_keyframes
|
||||
self.timestep_keyframes = timestep_keyframes if timestep_keyframes else TimestepKeyframeGroup()
|
||||
self.timestep_keyframes = timestep_keyframes if timestep_keyframes else TimestepKeyframeGroupImport()
|
||||
self.current_timestep_keyframe = self.timestep_keyframes.keyframes[0]
|
||||
# initialize weights
|
||||
self.weights = self.timestep_keyframes.keyframes[0].control_net_weights if self.timestep_keyframes.keyframes[0].control_net_weights else [1.0]*13
|
||||
@@ -243,7 +243,7 @@ class ControlNetAdvanced(ControlNet):
|
||||
control = self.control_model(x=x_noisy.to(self.control_model.dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(self.control_model.dtype), y=y)
|
||||
return self.control_merge(None, control, control_prev, output_dtype)
|
||||
|
||||
def apply_advanced_strengths_and_masks(self, x: Tensor, current_timestep_keyframe: TimestepKeyframe, batched_number: int):
|
||||
def apply_advanced_strengths_and_masks(self, x: Tensor, current_timestep_keyframe: TimestepKeyframeImport, batched_number: int):
|
||||
# apply strengths, and get batch indeces to default out
|
||||
# AKA latents that should not be influenced by ControlNet
|
||||
if current_timestep_keyframe.latent_keyframes is not None:
|
||||
@@ -288,7 +288,7 @@ class ControlNetAdvanced(ControlNet):
|
||||
x[:] = x[:] * masks
|
||||
|
||||
def copy(self):
|
||||
c = ControlNetAdvanced(self.control_model, self.timestep_keyframes, global_average_pooling=self.global_average_pooling)
|
||||
c = ControlNetAdvancedImport(self.control_model, self.timestep_keyframes, global_average_pooling=self.global_average_pooling)
|
||||
self.copy_to(c)
|
||||
return c
|
||||
|
||||
@@ -299,10 +299,10 @@ class ControlNetAdvanced(ControlNet):
|
||||
self.context_length = 0
|
||||
|
||||
|
||||
class T2IAdapterAdvanced(T2IAdapter):
|
||||
def __init__(self, t2i_model, timestep_keyframes: TimestepKeyframeGroup, channels_in, device=None):
|
||||
class T2IAdapterAdvancedImport(T2IAdapter):
|
||||
def __init__(self, t2i_model, timestep_keyframes: TimestepKeyframeGroupImport, channels_in, device=None):
|
||||
super().__init__(t2i_model=t2i_model, channels_in=channels_in, device=device)
|
||||
self.timestep_keyframes = timestep_keyframes if timestep_keyframes else TimestepKeyframeGroup()
|
||||
self.timestep_keyframes = timestep_keyframes if timestep_keyframes else TimestepKeyframeGroupImport()
|
||||
self.current_timestep_keyframe = self.timestep_keyframes.keyframes[0]
|
||||
first_weight = self.timestep_keyframes.keyframes[0].t2i_adapter_weights if self.timestep_keyframes.get_index(0) else None
|
||||
self.weights = first_weight if first_weight else [1.0]*12
|
||||
@@ -334,13 +334,13 @@ class T2IAdapterAdvanced(T2IAdapter):
|
||||
self.cond_hint_original = full_cond_hint_original
|
||||
del full_cond_hint_original
|
||||
|
||||
def apply_advanced_strengths_and_masks(self, x, current_timestep_keyframe: TimestepKeyframe, batched_number: int):
|
||||
def apply_advanced_strengths_and_masks(self, x, current_timestep_keyframe: TimestepKeyframeImport, batched_number: int):
|
||||
# For now, do nothing; need to figure out LatentKeyframe control is even possible for T2I Adapters
|
||||
# TODO: support masks
|
||||
return
|
||||
|
||||
def copy(self):
|
||||
c = T2IAdapterAdvanced(self.t2i_model, self.timestep_keyframes, self.channels_in)
|
||||
c = T2IAdapterAdvancedImport(self.t2i_model, self.timestep_keyframes, self.channels_in)
|
||||
self.copy_to(c)
|
||||
return c
|
||||
|
||||
@@ -351,21 +351,21 @@ class T2IAdapterAdvanced(T2IAdapter):
|
||||
self.context_length = 0
|
||||
|
||||
|
||||
def load_controlnet(ckpt_path, timestep_keyframe: TimestepKeyframeGroup=None, model=None):
|
||||
def load_controlnet(ckpt_path, timestep_keyframe: TimestepKeyframeGroupImport=None, model=None):
|
||||
control = comfy_cn.load_controlnet(ckpt_path, model=model)
|
||||
# if exactly ControlNet returned, transform it into ControlNetAdvanced
|
||||
if type(control) == ControlNet:
|
||||
return ControlNetAdvanced(control.control_model, timestep_keyframe, global_average_pooling=control.global_average_pooling)
|
||||
return ControlNetAdvancedImport(control.control_model, timestep_keyframe, global_average_pooling=control.global_average_pooling)
|
||||
# if T2IAdapter returned, transform it into T2IAdapterAdvanced
|
||||
elif isinstance(control, T2IAdapter):
|
||||
return T2IAdapterAdvanced(control.t2i_model, timestep_keyframe, control.channels_in)
|
||||
return T2IAdapterAdvancedImport(control.t2i_model, timestep_keyframe, control.channels_in)
|
||||
# otherwise, leave it be - probably a ControlLora for SDXL (no support for advanced stuff yet from here)
|
||||
# TODO add ControlLoraAdvanced
|
||||
return control
|
||||
|
||||
|
||||
def is_advanced_controlnet(input_object):
|
||||
return isinstance(input_object, ControlNetAdvanced) or isinstance(input_object, T2IAdapterAdvanced)
|
||||
return isinstance(input_object, ControlNetAdvancedImport) or isinstance(input_object, T2IAdapterAdvancedImport)
|
||||
|
||||
|
||||
# adapted from comfy/sample.py
|
||||
|
||||
@@ -2,11 +2,11 @@ from typing import Union
|
||||
import numpy as np
|
||||
from collections.abc import Iterable
|
||||
|
||||
from .control import LatentKeyframe, LatentKeyframeGroup
|
||||
from .control import LatentKeyframeImport, LatentKeyframeGroupImport
|
||||
from .logger import logger
|
||||
|
||||
|
||||
class LatentKeyframeNode:
|
||||
class LatentKeyframeNodeImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -27,15 +27,15 @@ class LatentKeyframeNode:
|
||||
def load_keyframe(self,
|
||||
batch_index: int,
|
||||
strength: float,
|
||||
prev_latent_keyframe: LatentKeyframeGroup=None):
|
||||
prev_latent_keyframe: LatentKeyframeGroupImport=None):
|
||||
if not prev_latent_keyframe:
|
||||
prev_latent_keyframe = LatentKeyframeGroup()
|
||||
keyframe = LatentKeyframe(batch_index, strength)
|
||||
prev_latent_keyframe = LatentKeyframeGroupImport()
|
||||
keyframe = LatentKeyframeImport(batch_index, strength)
|
||||
prev_latent_keyframe.add(keyframe)
|
||||
return (prev_latent_keyframe,)
|
||||
|
||||
|
||||
class LatentKeyframeGroupNode:
|
||||
class LatentKeyframeGroupNodeImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -77,7 +77,7 @@ class LatentKeyframeGroupNode:
|
||||
except ValueError as e:
|
||||
raise ValueError(f"index '{raw_index}' must be an integer.", e)
|
||||
|
||||
def convert_to_latent_keyframes(self, latent_indeces: str, latent_count: int) -> set[LatentKeyframe]:
|
||||
def convert_to_latent_keyframes(self, latent_indeces: str, latent_count: int) -> set[LatentKeyframeImport]:
|
||||
if not latent_indeces:
|
||||
return set()
|
||||
all_indeces = [i for i in range(0, latent_count)]
|
||||
@@ -105,19 +105,19 @@ class LatentKeyframeGroupNode:
|
||||
start_index = self.convert_to_index_int(index_range[0], latent_count=latent_count, is_range=True, allow_negative=allow_negative)
|
||||
end_index = self.convert_to_index_int(index_range[1], latent_count=latent_count, is_range=True, allow_negative=allow_negative)
|
||||
for i in all_indeces[start_index:end_index]:
|
||||
chosen_indeces.add(LatentKeyframe(i, strength))
|
||||
chosen_indeces.add(LatentKeyframImport(i, strength))
|
||||
# parse individual indeces
|
||||
else:
|
||||
chosen_indeces.add(LatentKeyframe(self.convert_to_index_int(g, latent_count=latent_count, allow_negative=allow_negative), strength))
|
||||
chosen_indeces.add(LatentKeyframeImport(self.convert_to_index_int(g, latent_count=latent_count, allow_negative=allow_negative), strength))
|
||||
return chosen_indeces
|
||||
|
||||
def load_keyframes(self,
|
||||
index_strengths: str,
|
||||
prev_latent_keyframe: LatentKeyframeGroup=None,
|
||||
prev_latent_keyframe: LatentKeyframeGroupImport=None,
|
||||
latent_image_opt=None):
|
||||
if not prev_latent_keyframe:
|
||||
prev_latent_keyframe = LatentKeyframeGroup()
|
||||
curr_latent_keyframe = LatentKeyframeGroup()
|
||||
prev_latent_keyframe = LatentKeyframeGroupImport()
|
||||
curr_latent_keyframe = LatentKeyframeGroupImport()
|
||||
|
||||
latent_count = -1
|
||||
if latent_image_opt:
|
||||
@@ -134,7 +134,7 @@ class LatentKeyframeGroupNode:
|
||||
return (curr_latent_keyframe,)
|
||||
|
||||
|
||||
class LatentKeyframeInterpolationNode:
|
||||
class LatentKeyframeInterpolationNodeImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -173,8 +173,8 @@ class LatentKeyframeInterpolationNode:
|
||||
raise ValueError("batch_index_from and batch_index_to must be either both positive or both negative.")
|
||||
|
||||
if not prev_latent_keyframe:
|
||||
prev_latent_keyframe = LatentKeyframeGroup()
|
||||
curr_latent_keyframe = LatentKeyframeGroup()
|
||||
prev_latent_keyframe = LatentKeyframeGroupImport()
|
||||
curr_latent_keyframe = LatentKeyframeGroupImport()
|
||||
|
||||
steps = batch_index_to_excl - batch_index_from
|
||||
diff = strength_to - strength_from
|
||||
@@ -197,7 +197,7 @@ class LatentKeyframeInterpolationNode:
|
||||
weights = np.concatenate([weights, weights[-2::-1]])
|
||||
|
||||
for i in range(steps):
|
||||
keyframe = LatentKeyframe(batch_index_from + i, float(weights[i]))
|
||||
keyframe = LatentKeyframeImport(batch_index_from + i, float(weights[i]))
|
||||
logger.info(f"keyframe {batch_index_from + i}:{weights[i]}")
|
||||
curr_latent_keyframe.add(keyframe)
|
||||
|
||||
@@ -208,7 +208,7 @@ class LatentKeyframeInterpolationNode:
|
||||
return (curr_latent_keyframe,)
|
||||
|
||||
|
||||
class LatentKeyframeBatchedGroupNode:
|
||||
class LatentKeyframeBatchedGroupNodeImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -224,10 +224,10 @@ class LatentKeyframeBatchedGroupNode:
|
||||
FUNCTION = "load_keyframe"
|
||||
CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝/keyframes"
|
||||
|
||||
def load_keyframe(self, strengths: Union[float, list[float]], prev_latent_keyframe: LatentKeyframeGroup=None):
|
||||
def load_keyframe(self, strengths: Union[float, list[float]], prev_latent_keyframe: LatentKeyframeGroupImport=None):
|
||||
if not prev_latent_keyframe:
|
||||
prev_latent_keyframe = LatentKeyframeGroup()
|
||||
curr_latent_keyframe = LatentKeyframeGroup()
|
||||
prev_latent_keyframe = LatentKeyframeGroupImport()
|
||||
curr_latent_keyframe = LatentKeyframeGroupImport()
|
||||
|
||||
# if received a normal float input, do nothing
|
||||
if type(strengths) in (float, int):
|
||||
@@ -235,7 +235,7 @@ class LatentKeyframeBatchedGroupNode:
|
||||
# if iterable, attempt to create LatentKeyframes with chosen strengths
|
||||
elif isinstance(strengths, Iterable):
|
||||
for idx, strength in enumerate(strengths):
|
||||
keyframe = LatentKeyframe(idx, strength)
|
||||
keyframe = LatentKeyframeImport(idx, strength)
|
||||
curr_latent_keyframe.add(keyframe)
|
||||
logger.info(f"keyframe {keyframe.batch_index}:{keyframe.strength}")
|
||||
else:
|
||||
|
||||
+34
-34
@@ -2,16 +2,16 @@ import numpy as np
|
||||
|
||||
import folder_paths
|
||||
|
||||
from .control import ControlNetAdvanced, T2IAdapterAdvanced, load_controlnet, ControlNetWeightsType, T2IAdapterWeightsType,\
|
||||
LatentKeyframeGroup, TimestepKeyframe, TimestepKeyframeGroup, is_advanced_controlnet
|
||||
from .weight_nodes import ScaledSoftControlNetWeights, SoftControlNetWeights, CustomControlNetWeights, \
|
||||
SoftT2IAdapterWeights, CustomT2IAdapterWeights
|
||||
from .latent_keyframe_nodes import LatentKeyframeGroupNode, LatentKeyframeInterpolationNode, LatentKeyframeBatchedGroupNode, LatentKeyframeNode
|
||||
from .control import ControlNetAdvancedImport, T2IAdapterAdvancedImport, load_controlnet, ControlNetWeightsTypeImport, T2IAdapterWeightsTypeImport,\
|
||||
LatentKeyframeGroupImport, TimestepKeyframeImport, TimestepKeyframeGroupImport, is_advanced_controlnet
|
||||
from .weight_nodes import ScaledSoftControlNetWeightsImport, SoftControlNetWeightsImport, CustomControlNetWeightsImport, \
|
||||
SoftT2IAdapterWeightsImport, CustomT2IAdapterWeightsImport
|
||||
from .latent_keyframe_nodes import LatentKeyframeGroupNodeImport, LatentKeyframeInterpolationNodeImport, LatentKeyframeBatchedGroupNodeImport, LatentKeyframeNodeImport
|
||||
from .deprecated_nodes import LoadImagesFromDirectory
|
||||
from .logger import logger
|
||||
|
||||
|
||||
class TimestepKeyframeNode:
|
||||
class TimestepKeyframeNodeImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -33,18 +33,18 @@ class TimestepKeyframeNode:
|
||||
|
||||
def load_keyframe(self,
|
||||
start_percent: float,
|
||||
control_net_weights: ControlNetWeightsType=None,
|
||||
t2i_adapter_weights: T2IAdapterWeightsType=None,
|
||||
latent_keyframe: LatentKeyframeGroup=None,
|
||||
prev_timestep_keyframe: TimestepKeyframeGroup=None):
|
||||
control_net_weights: ControlNetWeightsTypeImport=None,
|
||||
t2i_adapter_weights: T2IAdapterWeightsTypeImport=None,
|
||||
latent_keyframe: LatentKeyframeGroupImport=None,
|
||||
prev_timestep_keyframe: TimestepKeyframeGroupImport=None):
|
||||
if not prev_timestep_keyframe:
|
||||
prev_timestep_keyframe = TimestepKeyframeGroup()
|
||||
keyframe = TimestepKeyframe(start_percent, control_net_weights, t2i_adapter_weights, latent_keyframe)
|
||||
prev_timestep_keyframe = TimestepKeyframeGroupImport()
|
||||
keyframe = TimestepKeyframeImport(start_percent, control_net_weights, t2i_adapter_weights, latent_keyframe)
|
||||
prev_timestep_keyframe.add(keyframe)
|
||||
return (prev_timestep_keyframe,)
|
||||
|
||||
|
||||
class ControlNetLoaderAdvanced:
|
||||
class ControlNetLoaderAdvancedImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -61,13 +61,13 @@ class ControlNetLoaderAdvanced:
|
||||
|
||||
CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝/loaders"
|
||||
|
||||
def load_controlnet(self, control_net_name, timestep_keyframe: TimestepKeyframeGroup=None):
|
||||
def load_controlnet(self, control_net_name, timestep_keyframe: TimestepKeyframeGroupImport=None):
|
||||
controlnet_path = folder_paths.get_full_path("controlnet", control_net_name)
|
||||
controlnet = load_controlnet(controlnet_path, timestep_keyframe)
|
||||
return (controlnet,)
|
||||
|
||||
|
||||
class DiffControlNetLoaderAdvanced:
|
||||
class DiffControlNetLoaderAdvancedImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -85,13 +85,13 @@ class DiffControlNetLoaderAdvanced:
|
||||
|
||||
CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝/loaders"
|
||||
|
||||
def load_controlnet(self, control_net_name, timestep_keyframe: TimestepKeyframeGroup, model):
|
||||
def load_controlnet(self, control_net_name, timestep_keyframe: TimestepKeyframeGroupImport, model):
|
||||
controlnet_path = folder_paths.get_full_path("controlnet", control_net_name)
|
||||
controlnet = load_controlnet(controlnet_path, timestep_keyframe, model)
|
||||
return (controlnet,)
|
||||
|
||||
|
||||
class AdvancedControlNetApply:
|
||||
class AdvancedControlNetApplyImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -245,13 +245,13 @@ class LinearBatchCreativeInterpolationNode:
|
||||
strength_to = 1.0
|
||||
return_at_midpoint = True
|
||||
|
||||
latent_keyframe_interpolation_node = LatentKeyframeInterpolationNode()
|
||||
latent_keyframe_interpolation_node = LatentKeyframeInterpolationNodeImport()
|
||||
latent_keyframe, = latent_keyframe_interpolation_node.load_keyframe(batch_index_from, strength_from, batch_index_to_excl, strength_to, interpolation,return_at_midpoint)
|
||||
|
||||
scaled_soft_control_net_weights = ScaledSoftControlNetWeights()
|
||||
scaled_soft_control_net_weights = ScaledSoftControlNetWeightsImport()
|
||||
control_net_weights, _ = scaled_soft_control_net_weights.load_weights(soft_scaled_cn_weights_multiplier, False)
|
||||
|
||||
timestep_keyframe_node = TimestepKeyframeNode()
|
||||
timestep_keyframe_node = TimestepKeyframeNodeImport()
|
||||
timestep_keyframe, = timestep_keyframe_node.load_keyframe(
|
||||
start_percent=0.0,
|
||||
control_net_weights=control_net_weights,
|
||||
@@ -260,10 +260,10 @@ class LinearBatchCreativeInterpolationNode:
|
||||
prev_timestep_keyframe=None
|
||||
)
|
||||
|
||||
control_net_loader = ControlNetLoaderAdvanced()
|
||||
control_net_loader = ControlNetLoaderAdvancedImport()
|
||||
control_net, = control_net_loader.load_controlnet(control_net_name, timestep_keyframe)
|
||||
|
||||
apply_advanced_control_net = AdvancedControlNetApply()
|
||||
apply_advanced_control_net = AdvancedControlNetApplyImport()
|
||||
|
||||
positive, negative = apply_advanced_control_net.apply_controlnet(positive, negative, control_net, image.unsqueeze(0), cn_strength, 0.0, 1.0)
|
||||
|
||||
@@ -274,18 +274,18 @@ NODE_CLASS_MAPPINGS = {
|
||||
# Combined
|
||||
"LinearBatchCreativeInterpolation": LinearBatchCreativeInterpolationNode
|
||||
# Keyframes
|
||||
# "TimestepKeyframe": TimestepKeyframeNode,
|
||||
# "TimestepKeyframe": TimestepKeyframeNodeImport,
|
||||
# "LatentKeyframe": LatentKeyframeNode,
|
||||
# "LatentKeyframeGroup": LatentKeyframeGroupNode,
|
||||
# "LatentKeyframeGroupImport": LatentKeyframeGroupImportNode,
|
||||
# "LatentKeyframeBatchedGroup": LatentKeyframeBatchedGroupNode,
|
||||
# "LatentKeyframeTiming": LatentKeyframeInterpolationNode,
|
||||
# "LatentKeyframeTiming": LatentKeyframeInterpolationNodeImport,
|
||||
# Loaders
|
||||
# "ControlNetLoaderAdvanced": ControlNetLoaderAdvanced,
|
||||
# "DiffControlNetLoaderAdvanced": DiffControlNetLoaderAdvanced,
|
||||
# "ControlNetLoaderAdvancedImport": ControlNetLoaderAdvancedImport,
|
||||
# "DiffControlNetLoaderAdvancedImport": DiffControlNetLoaderAdvancedImport,
|
||||
# Conditioning
|
||||
# "ACN_AdvancedControlNetApply": AdvancedControlNetApply,
|
||||
# "ACN_AdvancedControlNetApplyImport": AdvancedControlNetApplyImport,
|
||||
# Weights
|
||||
# "ScaledSoftControlNetWeights": ScaledSoftControlNetWeights,
|
||||
# "ScaledSoftControlNetWeightsImport": ScaledSoftControlNetWeightsImport,
|
||||
# "SoftControlNetWeights": SoftControlNetWeights,
|
||||
# "CustomControlNetWeights": CustomControlNetWeights,
|
||||
# "SoftT2IAdapterWeights": SoftT2IAdapterWeights,
|
||||
@@ -300,16 +300,16 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
# Keyframes
|
||||
# "TimestepKeyframe": "Timestep Keyframe 🎞️🅟🅞🅜",
|
||||
# "LatentKeyframe": "Latent Keyframe 🛂🅐🅒🅝",
|
||||
# "LatentKeyframeGroup": "Latent Keyframe Group 🛂🅐🅒🅝",
|
||||
# "LatentKeyframeGroupImport": "Latent Keyframe Group 🛂🅐🅒🅝",
|
||||
# "LatentKeyframeBatchedGroup": "Latent Keyframe Batched Group 🛂🅐🅒🅝",
|
||||
# "LatentKeyframeTiming": "Latent Keyframe Interpolation 🛂🅐🅒🅝",
|
||||
# Loaders
|
||||
# "ControlNetLoaderAdvanced": "Load ControlNet Model (Advanced) 🛂🅐🅒🅝",
|
||||
# "DiffControlNetLoaderAdvanced": "Load ControlNet Model (diff Advanced) 🛂🅐🅒🅝",
|
||||
# "ControlNetLoaderAdvancedImport": "Load ControlNet Model (Advanced) 🛂🅐🅒🅝",
|
||||
# "DiffControlNetLoaderAdvancedImport": "Load ControlNet Model (diff Advanced) 🛂🅐🅒🅝",
|
||||
# Conditioning
|
||||
# "ACN_AdvancedControlNetApply": "Apply Advanced ControlNet 🛂🅐🅒🅝",
|
||||
# "ACN_AdvancedControlNetApplyImport": "Apply Advanced ControlNet 🛂🅐🅒🅝",
|
||||
# Weights
|
||||
# "ScaledSoftControlNetWeights": "Scaled Soft ControlNet Weights 🛂🅐🅒🅝",
|
||||
# "ScaledSoftControlNetWeightsImport": "Scaled Soft ControlNet Weights 🛂🅐🅒🅝",
|
||||
# "SoftControlNetWeights": "Soft ControlNet Weights 🛂🅐🅒🅝",
|
||||
# "CustomControlNetWeights": "Custom ControlNet Weights 🛂🅐🅒🅝",
|
||||
# "SoftT2IAdapterWeights": "Soft T2IAdapter Weights 🛂🅐🅒🅝",
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
from .control import TimestepKeyframe, TimestepKeyframeGroup
|
||||
from .control import TimestepKeyframeImport, TimestepKeyframeGroupImport
|
||||
from .logger import logger
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ def get_properly_arranged_t2i_weights(initial_weights: list[float]):
|
||||
return new_weights
|
||||
|
||||
|
||||
class ScaledSoftControlNetWeights:
|
||||
class ScaledSoftControlNetWeightsImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -30,10 +30,10 @@ class ScaledSoftControlNetWeights:
|
||||
weights = [(base_multiplier ** float(12 - i)) for i in range(13)]
|
||||
if flip_weights:
|
||||
weights.reverse()
|
||||
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_net_weights=weights)))
|
||||
return (weights, TimestepKeyframeGroupImport.default(TimestepKeyframeImport(control_net_weights=weights)))
|
||||
|
||||
|
||||
class SoftControlNetWeights:
|
||||
class SoftControlNetWeightsImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -66,10 +66,10 @@ class SoftControlNetWeights:
|
||||
weight_07, weight_08, weight_09, weight_10, weight_11, weight_12]
|
||||
if flip_weights:
|
||||
weights.reverse()
|
||||
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_net_weights=weights)))
|
||||
return (weights, TimestepKeyframeGroupImport.default(TimestepKeyframeImport(control_net_weights=weights)))
|
||||
|
||||
|
||||
class CustomControlNetWeights:
|
||||
class CustomControlNetWeightsImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -102,10 +102,10 @@ class CustomControlNetWeights:
|
||||
weight_07, weight_08, weight_09, weight_10, weight_11, weight_12]
|
||||
if flip_weights:
|
||||
weights.reverse()
|
||||
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_net_weights=weights)))
|
||||
return (weights, TimestepKeyframeGroupImport.default(TimestepKeyframeImport(control_net_weights=weights)))
|
||||
|
||||
|
||||
class SoftT2IAdapterWeights:
|
||||
class SoftT2IAdapterWeightsImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -128,10 +128,10 @@ class SoftT2IAdapterWeights:
|
||||
if flip_weights:
|
||||
weights.reverse()
|
||||
weights = get_properly_arranged_t2i_weights(weights)
|
||||
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(t2i_adapter_weights=weights)))
|
||||
return (weights, TimestepKeyframeGroupImport.default(TimestepKeyframeImport(t2i_adapter_weights=weights)))
|
||||
|
||||
|
||||
class CustomT2IAdapterWeights:
|
||||
class CustomT2IAdapterWeightsImport:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
@@ -154,4 +154,4 @@ class CustomT2IAdapterWeights:
|
||||
if flip_weights:
|
||||
weights.reverse()
|
||||
weights = get_properly_arranged_t2i_weights(weights)
|
||||
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(t2i_adapter_weights=weights)))
|
||||
return (weights, TimestepKeyframeGroupImport.default(TimestepKeyframeImport(t2i_adapter_weights=weights)))
|
||||
|
||||
Reference in New Issue
Block a user