EasyControlnet¶
Documentation¶
- Class name:
easy controlnetLoader
- Category:
EasyUse/Loaders
- Output node:
True
The easy controlnetLoader
node is designed to simplify the process of loading control networks within the ComfyUI framework. It abstracts the complexities involved in fetching and applying control networks to models, offering a streamlined interface for users to easily integrate control networks into their projects.
Input types¶
Required¶
pipe
- Represents the pipeline configuration for which the control network is being loaded. It is essential for ensuring that the control network is applied correctly within the specified pipeline.
- Comfy dtype:
PIPE_LINE
- Python dtype:
dict
image
- The image to which the control network will be applied. This parameter is crucial for visualizing the effects of the control network on specific images.
- Comfy dtype:
IMAGE
- Python dtype:
torch.Tensor
control_net_name
- Specifies the name of the control network to be loaded. This parameter is crucial as it determines which control network is fetched and applied, directly impacting the behavior of the model.
- Comfy dtype:
COMBO[STRING]
- Python dtype:
str
Optional¶
control_net
- An optional parameter that, if provided, specifies a pre-loaded control network to be applied. This allows for more flexibility in using custom or pre-configured control networks.
- Comfy dtype:
CONTROL_NET
- Python dtype:
object
strength
- Defines the intensity with which the control network influences the model. This parameter allows users to adjust the impact level of the control network on the output.
- Comfy dtype:
FLOAT
- Python dtype:
float
scale_soft_weights
- Adjusts the softness of the weights applied to the control network. This parameter allows for fine-tuning the influence of the control network on the model, enabling users to achieve the desired level of control.
- Comfy dtype:
FLOAT
- Python dtype:
float
Output types¶
pipe
- Comfy dtype:
PIPE_LINE
- The updated pipeline configuration, including the applied control network.
- Python dtype:
dict
- Comfy dtype:
positive
- Comfy dtype:
CONDITIONING
- The positive conditioning effects generated by the control network.
- Python dtype:
list
- Comfy dtype:
negative
- Comfy dtype:
CONDITIONING
- The negative conditioning effects generated by the control network.
- Python dtype:
list
- Comfy dtype:
Usage tips¶
- Infra type:
CPU
- Common nodes: unknown
Source code¶
class controlnetSimple:
@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}),
"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, scale_soft_weights=1):
positive, negative = easyControlnet().apply(control_net_name, image, pipe["positive"], pipe["negative"], strength, 0, 1, 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)