Skip to content

Commit

Permalink
Add an optional VAE input to the ControlNetApplyAdvanced node.
Browse files Browse the repository at this point in the history
Deprecate the other controlnet nodes.
  • Loading branch information
comfyanonymous committed Sep 22, 2024
1 parent 89fa2fc commit 7a415f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion comfy/controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def get_control(self, x_noisy, t, cond, batched_number):
compression_ratio *= self.vae.downscale_ratio
else:
if self.latent_format is not None:
raise ValueError("This Controlnet needs a VAE but none was provided, please use a different ControlNetApply node with a VAE input.")
raise ValueError("This Controlnet needs a VAE but none was provided, please use a ControlNetApply node with a VAE input and connect it.")
self.cond_hint = comfy.utils.common_upscale(self.cond_hint_original, x_noisy.shape[3] * compression_ratio, x_noisy.shape[2] * compression_ratio, self.upscale_algorithm, "center")
if self.vae is not None:
loaded_models = comfy.model_management.loaded_models(only_currently_used=True)
Expand Down
3 changes: 2 additions & 1 deletion comfy_extras/nodes_sd3.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def INPUT_TYPES(s):
"end_percent": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001})
}}
CATEGORY = "conditioning/controlnet"
DEPRECATED = True

NODE_CLASS_MAPPINGS = {
"TripleCLIPLoader": TripleCLIPLoader,
Expand All @@ -103,5 +104,5 @@ def INPUT_TYPES(s):

NODE_DISPLAY_NAME_MAPPINGS = {
# Sampling
"ControlNetApplySD3": "Apply Controlnet",
"ControlNetApplySD3": "Apply Controlnet with VAE",
}
8 changes: 6 additions & 2 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ def INPUT_TYPES(s):
RETURN_TYPES = ("CONDITIONING",)
FUNCTION = "apply_controlnet"

DEPRECATED = True
CATEGORY = "conditioning/controlnet"

def apply_controlnet(self, conditioning, control_net, image, strength):
Expand Down Expand Up @@ -816,7 +817,10 @@ def INPUT_TYPES(s):
"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})
}}
},
"optional": {"vae": ("VAE", ),
}
}

RETURN_TYPES = ("CONDITIONING","CONDITIONING")
RETURN_NAMES = ("positive", "negative")
Expand Down Expand Up @@ -1918,7 +1922,7 @@ def expand_image(self, image, left, top, right, bottom, feathering):
"ConditioningSetAreaPercentage": "Conditioning (Set Area with Percentage)",
"ConditioningSetMask": "Conditioning (Set Mask)",
"ControlNetApply": "Apply ControlNet (OLD)",
"ControlNetApplyAdvanced": "Apply ControlNet (OLD Advanced)",
"ControlNetApplyAdvanced": "Apply ControlNet",
# Latent
"VAEEncodeForInpaint": "VAE Encode (for Inpainting)",
"SetLatentNoiseMask": "Set Latent Noise Mask",
Expand Down

0 comments on commit 7a415f4

Please sign in to comment.