Skip to content

ControlNet Soft Weights 🛂🅐🅒🅝

Documentation

  • Class name: SoftControlNetWeights
  • Category: Adv-ControlNet 🛂🅐🅒🅝/weights/ControlNet
  • Output node: False

The SoftControlNetWeights node is designed for generating dynamic control net weights based on a series of individual weight parameters and an optional flip weights flag. This configuration allows for customizing the distribution and orientation of control net weights, enabling precise adjustments to the control net's behavior.

Input types

Required

  • weight_i
    • Specifies the value for an individual weight in the control net, contributing to the overall weight configuration. The index 'i' ranges from 0 to 3, indicating each specific weight's position.
    • Comfy dtype: FLOAT
    • Python dtype: float
  • flip_weights
    • A boolean flag that, when set to true, flips the weights, altering their application and effect on the control net.
    • Comfy dtype: BOOLEAN
    • Python dtype: bool

Output types

  • CN_WEIGHTS
    • Comfy dtype: CONTROL_NET_WEIGHTS
    • Represents the customized control net weights, adjusted according to the specified individual weight values and flip flag.
    • Python dtype: ControlWeights
  • TK_SHORTCUT
    • Comfy dtype: TIMESTEP_KEYFRAME
    • A timestep keyframe group that incorporates the customized control weights, facilitating their application in temporal control scenarios.
    • Python dtype: TimestepKeyframeGroup

Usage tips

  • Infra type: CPU
  • Common nodes: unknown

Source code

class SoftControlNetWeights:
    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
                "weight_00": ("FLOAT", {"default": 0.09941396206337118, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_01": ("FLOAT", {"default": 0.12050177219802567, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_02": ("FLOAT", {"default": 0.14606275417942507, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_03": ("FLOAT", {"default": 0.17704576264172736, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_04": ("FLOAT", {"default": 0.214600924414215, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_05": ("FLOAT", {"default": 0.26012233262329093, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_06": ("FLOAT", {"default": 0.3152997971191405, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_07": ("FLOAT", {"default": 0.3821815722656249, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_08": ("FLOAT", {"default": 0.4632503906249999, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_09": ("FLOAT", {"default": 0.561515625, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_10": ("FLOAT", {"default": 0.6806249999999999, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_11": ("FLOAT", {"default": 0.825, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "weight_12": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
                "flip_weights": ("BOOLEAN", {"default": False}),
            },
        }

    RETURN_TYPES = ("CONTROL_NET_WEIGHTS", "TIMESTEP_KEYFRAME",)
    RETURN_NAMES = WEIGHTS_RETURN_NAMES
    FUNCTION = "load_weights"

    CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝/weights/ControlNet"

    def load_weights(self, weight_00, weight_01, weight_02, weight_03, weight_04, weight_05, weight_06, 
                     weight_07, weight_08, weight_09, weight_10, weight_11, weight_12, flip_weights):
        weights = [weight_00, weight_01, weight_02, weight_03, weight_04, weight_05, weight_06, 
                   weight_07, weight_08, weight_09, weight_10, weight_11, weight_12]
        weights = ControlWeights.controlnet(weights, flip_weights=flip_weights)
        return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_weights=weights)))