Replaced base Load Advanced ControlNet Model nodes with ones with cnet instead of control_net_name to leave more room for CN name

This commit is contained in:
Jedrzej Kosinski
2024-11-14 04:57:12 -06:00
parent 828c270a85
commit 820a591687
3 changed files with 88 additions and 23 deletions
+10 -5
View File
@@ -22,7 +22,8 @@ from .nodes_loosecontrol import ControlNetLoaderWithLoraAdvanced
from .nodes_deprecated import (LoadImagesFromDirectory, ScaledSoftUniversalWeightsDeprecated,
SoftControlNetWeightsDeprecated, CustomControlNetWeightsDeprecated,
SoftT2IAdapterWeightsDeprecated, CustomT2IAdapterWeightsDeprecated,
AdvancedControlNetApplyDEPR, AdvancedControlNetApplySingleDEPR)
AdvancedControlNetApplyDEPR, AdvancedControlNetApplySingleDEPR,
ControlNetLoaderAdvancedDEPR, DiffControlNetLoaderAdvancedDEPR)
from .logger import logger
from .sampling import acn_sample_factory
@@ -45,8 +46,8 @@ NODE_CLASS_MAPPINGS = {
"ACN_AdvancedControlNetApply_v2": AdvancedControlNetApply,
"ACN_AdvancedControlNetApplySingle_v2": AdvancedControlNetApplySingle,
# Loaders
"ControlNetLoaderAdvanced": ControlNetLoaderAdvanced,
"DiffControlNetLoaderAdvanced": DiffControlNetLoaderAdvanced,
"ACN_ControlNetLoaderAdvanced": ControlNetLoaderAdvanced,
"ACN_DiffControlNetLoaderAdvanced": DiffControlNetLoaderAdvanced,
# Weights
"ACN_ScaledSoftControlNetWeights": ScaledSoftUniversalWeights,
"ScaledSoftMaskedUniversalWeights": ScaledSoftMaskedUniversalWeights,
@@ -82,6 +83,8 @@ NODE_CLASS_MAPPINGS = {
"CustomT2IAdapterWeights": CustomT2IAdapterWeightsDeprecated,
"ACN_AdvancedControlNetApply": AdvancedControlNetApplyDEPR,
"ACN_AdvancedControlNetApplySingle": AdvancedControlNetApplySingleDEPR,
"ControlNetLoaderAdvanced": ControlNetLoaderAdvancedDEPR,
"DiffControlNetLoaderAdvanced": DiffControlNetLoaderAdvancedDEPR,
}
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -97,8 +100,8 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"ACN_AdvancedControlNetApply_v2": "Apply Advanced ControlNet 🛂🅐🅒🅝",
"ACN_AdvancedControlNetApplySingle_v2": "Apply Advanced ControlNet(1) 🛂🅐🅒🅝",
# Loaders
"ControlNetLoaderAdvanced": "Load Advanced ControlNet Model 🛂🅐🅒🅝",
"DiffControlNetLoaderAdvanced": "Load Advanced ControlNet Model (diff) 🛂🅐🅒🅝",
"ACN_ControlNetLoaderAdvanced": "Load Advanced ControlNet Model 🛂🅐🅒🅝",
"ACN_DiffControlNetLoaderAdvanced": "Load Advanced ControlNet Model (diff) 🛂🅐🅒🅝",
# Weights
"ACN_ScaledSoftControlNetWeights": "Scaled Soft Weights 🛂🅐🅒🅝",
"ScaledSoftMaskedUniversalWeights": "Scaled Soft Masked Weights 🛂🅐🅒🅝",
@@ -134,4 +137,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"CustomT2IAdapterWeights": "T2IAdapter Custom Weights 🛂🅐🅒🅝",
"ACN_AdvancedControlNetApply": "Apply Advanced ControlNet 🛂🅐🅒🅝",
"ACN_AdvancedControlNetApplySingle": "Apply Advanced ControlNet(1) 🛂🅐🅒🅝",
"ControlNetLoaderAdvanced": "Load Advanced ControlNet Model 🛂🅐🅒🅝",
"DiffControlNetLoaderAdvanced": "Load Advanced ControlNet Model (diff) 🛂🅐🅒🅝",
}
+66
View File
@@ -1,9 +1,11 @@
import os
import torch
import folder_paths
import numpy as np
from PIL import Image, ImageOps
from .control import load_controlnet, is_advanced_controlnet
from .nodes_main import AdvancedControlNetApply
from .utils import BIGMAX, ControlWeights, TimestepKeyframeGroup, TimestepKeyframe, get_properly_arranged_t2i_weights
from .logger import logger
@@ -348,3 +350,67 @@ class AdvancedControlNetApplySingleDEPR:
timestep_kf=timestep_kf, latent_kf_override=latent_kf_override, weights_override=weights_override,
control_apply_to_uncond=True)
return (values[0], model_optional)
class ControlNetLoaderAdvancedDEPR:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"control_net_name": (folder_paths.get_filename_list("controlnet"), ),
},
"optional": {
"tk_optional": ("TIMESTEP_KEYFRAME", ),
}
}
DEPRECATED = True
RETURN_TYPES = ("CONTROL_NET", )
FUNCTION = "load_controlnet"
CATEGORY = ""
def load_controlnet(self, control_net_name,
tk_optional: TimestepKeyframeGroup=None,
timestep_keyframe: TimestepKeyframeGroup=None,
):
if timestep_keyframe is not None: # backwards compatibility
tk_optional = timestep_keyframe
controlnet_path = folder_paths.get_full_path("controlnet", control_net_name)
controlnet = load_controlnet(controlnet_path, tk_optional)
return (controlnet,)
class DiffControlNetLoaderAdvancedDEPR:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"model": ("MODEL",),
"control_net_name": (folder_paths.get_filename_list("controlnet"), )
},
"optional": {
"tk_optional": ("TIMESTEP_KEYFRAME", ),
},
"hidden": {
"autosize": ("ACNAUTOSIZE", {"padding": 0}),
}
}
DEPRECATED = True
RETURN_TYPES = ("CONTROL_NET", )
FUNCTION = "load_controlnet"
CATEGORY = ""
def load_controlnet(self, control_net_name, model,
tk_optional: TimestepKeyframeGroup=None,
timestep_keyframe: TimestepKeyframeGroup=None
):
if timestep_keyframe is not None: # backwards compatibility
tk_optional = timestep_keyframe
controlnet_path = folder_paths.get_full_path("controlnet", control_net_name)
controlnet = load_controlnet(controlnet_path, tk_optional, model)
if is_advanced_controlnet(controlnet):
controlnet.verify_all_weights()
return (controlnet,)
+12 -18
View File
@@ -14,10 +14,10 @@ class ControlNetLoaderAdvanced:
def INPUT_TYPES(s):
return {
"required": {
"control_net_name": (folder_paths.get_filename_list("controlnet"), ),
"cnet": (folder_paths.get_filename_list("controlnet"), ),
},
"optional": {
"tk_optional": ("TIMESTEP_KEYFRAME", ),
"_tk_opt": ("TIMESTEP_KEYFRAME", ),
}
}
@@ -26,14 +26,11 @@ class ControlNetLoaderAdvanced:
CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝"
def load_controlnet(self, control_net_name,
tk_optional: TimestepKeyframeGroup=None,
timestep_keyframe: TimestepKeyframeGroup=None,
def load_controlnet(self, cnet,
_tk_opt: TimestepKeyframeGroup=None,
):
if timestep_keyframe is not None: # backwards compatibility
tk_optional = timestep_keyframe
controlnet_path = folder_paths.get_full_path("controlnet", control_net_name)
controlnet = load_controlnet(controlnet_path, tk_optional)
controlnet_path = folder_paths.get_full_path("controlnet", cnet)
controlnet = load_controlnet(controlnet_path, _tk_opt)
return (controlnet,)
@@ -43,10 +40,10 @@ class DiffControlNetLoaderAdvanced:
return {
"required": {
"model": ("MODEL",),
"control_net_name": (folder_paths.get_filename_list("controlnet"), )
"cnet": (folder_paths.get_filename_list("controlnet"), )
},
"optional": {
"tk_optional": ("TIMESTEP_KEYFRAME", ),
"_tk_opt": ("TIMESTEP_KEYFRAME", ),
},
"hidden": {
"autosize": ("ACNAUTOSIZE", {"padding": 0}),
@@ -58,14 +55,11 @@ class DiffControlNetLoaderAdvanced:
CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝"
def load_controlnet(self, control_net_name, model,
tk_optional: TimestepKeyframeGroup=None,
timestep_keyframe: TimestepKeyframeGroup=None
def load_controlnet(self, cnet, model,
_tk_opt: TimestepKeyframeGroup=None,
):
if timestep_keyframe is not None: # backwards compatibility
tk_optional = timestep_keyframe
controlnet_path = folder_paths.get_full_path("controlnet", control_net_name)
controlnet = load_controlnet(controlnet_path, tk_optional, model)
controlnet_path = folder_paths.get_full_path("controlnet", cnet)
controlnet = load_controlnet(controlnet_path, _tk_opt, model)
if is_advanced_controlnet(controlnet):
controlnet.verify_all_weights()
return (controlnet,)