mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-08 20:34:35 +08:00
Add CustomControlNetWeightsFluxFromList
This commit is contained in:
parent
ca0e1ad28d
commit
912cbd2ab6
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ __pycache__
|
|||||||
types
|
types
|
||||||
models
|
models
|
||||||
jsconfig.json
|
jsconfig.json
|
||||||
|
custom_dimensions.json
|
||||||
|
|||||||
@ -138,6 +138,7 @@ NODE_CONFIG = {
|
|||||||
"DifferentialDiffusionAdvanced": {"class": DifferentialDiffusionAdvanced, "name": "Differential Diffusion Advanced"},
|
"DifferentialDiffusionAdvanced": {"class": DifferentialDiffusionAdvanced, "name": "Differential Diffusion Advanced"},
|
||||||
"FluxBlockLoraLoader": {"class": FluxBlockLoraLoader, "name": "Flux Block Lora Loader"},
|
"FluxBlockLoraLoader": {"class": FluxBlockLoraLoader, "name": "Flux Block Lora Loader"},
|
||||||
"FluxBlockLoraSelect": {"class": FluxBlockLoraSelect, "name": "Flux Block Lora Select"},
|
"FluxBlockLoraSelect": {"class": FluxBlockLoraSelect, "name": "Flux Block Lora Select"},
|
||||||
|
"CustomControlNetWeightsFluxFromList": {"class": CustomControlNetWeightsFluxFromList, "name": "Custom ControlNet Weights Flux From List"},
|
||||||
|
|
||||||
#instance diffusion
|
#instance diffusion
|
||||||
"CreateInstanceDiffusionTracking": {"class": CreateInstanceDiffusionTracking},
|
"CreateInstanceDiffusionTracking": {"class": CreateInstanceDiffusionTracking},
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import numpy as np
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
import json, re, os, io, time
|
import json, re, os, io, time
|
||||||
|
import importlib
|
||||||
import model_management
|
import model_management
|
||||||
import folder_paths
|
import folder_paths
|
||||||
from nodes import MAX_RESOLUTION
|
from nodes import MAX_RESOLUTION
|
||||||
@ -1990,4 +1990,37 @@ class FluxBlockLoraLoader:
|
|||||||
if (x not in k):
|
if (x not in k):
|
||||||
print("NOT LOADED {}".format(x))
|
print("NOT LOADED {}".format(x))
|
||||||
|
|
||||||
return (new_modelpatcher, rank)
|
return (new_modelpatcher, rank)
|
||||||
|
|
||||||
|
class CustomControlNetWeightsFluxFromList:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"list_of_floats": ("FLOAT", {"forceInput": True}, ),
|
||||||
|
},
|
||||||
|
"optional": {
|
||||||
|
"uncond_multiplier": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}, ),
|
||||||
|
"cn_extras": ("CN_WEIGHTS_EXTRAS",),
|
||||||
|
"autosize": ("ACNAUTOSIZE", {"padding": 0}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_TYPES = ("CONTROL_NET_WEIGHTS", "TIMESTEP_KEYFRAME",)
|
||||||
|
RETURN_NAMES = ("CN_WEIGHTS", "TK_SHORTCUT")
|
||||||
|
FUNCTION = "load_weights"
|
||||||
|
DESCRIPTION = "Creates controlnet weights from a list of floats for Advanced-ControlNet"
|
||||||
|
|
||||||
|
CATEGORY = "KJNodes/controlnet"
|
||||||
|
|
||||||
|
def load_weights(self, list_of_floats: list[float],
|
||||||
|
uncond_multiplier: float=1.0, cn_extras: dict[str]={}):
|
||||||
|
|
||||||
|
acn_nodes = importlib.import_module("ComfyUI-Advanced-ControlNet")
|
||||||
|
ControlWeights = acn_nodes.adv_control.utils.ControlWeights
|
||||||
|
TimestepKeyframeGroup = acn_nodes.adv_control.utils.TimestepKeyframeGroup
|
||||||
|
TimestepKeyframe = acn_nodes.adv_control.utils.TimestepKeyframe
|
||||||
|
|
||||||
|
weights = ControlWeights.controlnet(weights_input=list_of_floats, uncond_multiplier=uncond_multiplier, extras=cn_extras)
|
||||||
|
print(weights.weights_input)
|
||||||
|
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_weights=weights)))
|
||||||
Loading…
x
Reference in New Issue
Block a user