Skip to content

EasyControlnet (Advanced)

Documentation

  • Class name: easy controlnetLoaderADV
  • Category: EasyUse/Loaders
  • Output node: True

The easy controlnetLoaderADV node specializes in loading advanced control networks for use in generative models, offering enhanced capabilities over standard loaders by supporting additional parameters and configurations. It facilitates the dynamic adjustment and application of control networks to influence the generation process, accommodating complex requirements and customization needs.

Input types

Required

  • pipe
    • Represents the pipeline context in which the control network will be applied, providing a framework for the integration and application of the control network.
    • Comfy dtype: PIPE_LINE
    • Python dtype: dict
  • image
    • The image to which the control network adjustments will be applied, serving as the direct target for the control network's effects.
    • Comfy dtype: IMAGE
    • Python dtype: ImageType
  • control_net_name
    • The name of the control network to be loaded, acting as a key identifier for retrieving the specific control network configuration from a predefined list or directory.
    • Comfy dtype: COMBO[STRING]
    • Python dtype: str

Optional

  • control_net
    • An optional parameter allowing for the specification of an already loaded control network, facilitating reuse and efficiency in processing.
    • Comfy dtype: CONTROL_NET
    • Python dtype: ControlNetType
  • strength
    • Defines the intensity of the control network's effect on the image, allowing for fine-tuned adjustments to the generation process.
    • Comfy dtype: FLOAT
    • Python dtype: float
  • start_percent
    • Specifies the starting point of the control network's effect in terms of the generation process timeline, enabling phased application.
    • Comfy dtype: FLOAT
    • Python dtype: float
  • end_percent
    • Determines the end point of the control network's effect, allowing for precise control over the duration and timing of its influence.
    • Comfy dtype: FLOAT
    • Python dtype: float
  • scale_soft_weights
    • Adjusts the softness of the control network's weights, providing an additional layer of customization for the control network's application.
    • Comfy dtype: FLOAT
    • Python dtype: float

Output types

  • pipe
    • Comfy dtype: PIPE_LINE
    • The updated pipeline context, reflecting the application of the control network.
    • Python dtype: dict
  • positive
    • Comfy dtype: CONDITIONING
    • The positive conditioning effects resulting from the control network's application, enhancing the generative model's output.
    • Python dtype: ConditioningType
  • negative
    • Comfy dtype: CONDITIONING
    • The negative conditioning effects, offering a counterbalance to the positive effects and enriching the model's generative capabilities.
    • Python dtype: ConditioningType
  • ui
    • A user interface component generated by the node, facilitating interaction and visualization of the control network's effects.

Usage tips

  • Infra type: CPU
  • Common nodes: unknown

Source code

class controlnetAdvanced:

    @classmethod
    def INPUT_TYPES(s):
        def get_file_list(filenames):
            return [file for file in filenames if file != "put_models_here.txt" and "lllite" not in file]

        return {
            "required": {
                "pipe": ("PIPE_LINE",),
                "image": ("IMAGE",),
                "control_net_name": (get_file_list(folder_paths.get_filename_list("controlnet")),),
            },
            "optional": {
                "control_net": ("CONTROL_NET",),
                "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
                "start_percent": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}),
                "end_percent": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001}),
                "scale_soft_weights": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001},),
            }
        }

    RETURN_TYPES = ("PIPE_LINE", "CONDITIONING", "CONDITIONING")
    RETURN_NAMES = ("pipe", "positive", "negative")
    OUTPUT_NODE = True

    FUNCTION = "controlnetApply"
    CATEGORY = "EasyUse/Loaders"


    def controlnetApply(self, pipe, image, control_net_name, control_net=None, strength=1, start_percent=0, end_percent=1, scale_soft_weights=1):
        positive, negative = easyControlnet().apply(control_net_name, image, pipe["positive"], pipe["negative"],
                                                    strength, start_percent, end_percent, control_net, scale_soft_weights, None, easyCache)

        new_pipe = {
            "model": pipe['model'],
            "positive": positive,
            "negative": negative,
            "vae": pipe['vae'],
            "clip": pipe['clip'],

            "samples": pipe["samples"],
            "images": pipe["images"],
            "seed": 0,

            "loader_settings": pipe["loader_settings"]
        }

        del pipe

        return (new_pipe, positive, negative)