76 lines
3.5 KiB
Markdown
76 lines
3.5 KiB
Markdown
---
|
|
tags:
|
|
- ControlNet
|
|
- Weight
|
|
---
|
|
|
|
# ControlNet Custom Weights 🛂🅐🅒🅝
|
|
## Documentation
|
|
- Class name: `CustomControlNetWeights`
|
|
- Category: `Adv-ControlNet 🛂🅐🅒🅝/weights/ControlNet`
|
|
- Output node: `False`
|
|
|
|
This node is designed for loading and applying custom control net weights to influence the behavior of an advanced control network. It allows for fine-tuning the control network's response by adjusting individual weight parameters and optionally flipping the weights to achieve desired effects.
|
|
## Input types
|
|
### Required
|
|
- **`weight_i`**
|
|
- unknown
|
|
- Comfy dtype: `FLOAT`
|
|
- Python dtype: `unknown`
|
|
- **`flip_weights`**
|
|
- Determines whether the control weights should be inverted, offering an alternative approach to modifying the control network's behavior.
|
|
- Comfy dtype: `BOOLEAN`
|
|
- Python dtype: `bool`
|
|
## Output types
|
|
- **`CN_WEIGHTS`**
|
|
- Comfy dtype: `CONTROL_NET_WEIGHTS`
|
|
- The adjusted control net weights, ready for application within the control network.
|
|
- Python dtype: `list[float]`
|
|
- **`TK_SHORTCUT`**
|
|
- Comfy dtype: `TIMESTEP_KEYFRAME`
|
|
- A keyframe group representing the timestep adjustments made through the control weights.
|
|
- Python dtype: `TimestepKeyframeGroup`
|
|
## Usage tips
|
|
- Infra type: `CPU`
|
|
- Common nodes: unknown
|
|
|
|
|
|
## Source code
|
|
```python
|
|
class CustomControlNetWeights:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {
|
|
"required": {
|
|
"weight_00": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_01": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_02": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_03": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_04": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_05": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_06": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_07": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_08": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_09": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_10": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_11": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"weight_12": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.001}, ),
|
|
"flip_weights": ("BOOLEAN", {"default": False}),
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("CONTROL_NET_WEIGHTS", "TIMESTEP_KEYFRAME",)
|
|
RETURN_NAMES = WEIGHTS_RETURN_NAMES
|
|
FUNCTION = "load_weights"
|
|
|
|
CATEGORY = "Adv-ControlNet 🛂🅐🅒🅝/weights/ControlNet"
|
|
|
|
def load_weights(self, weight_00, weight_01, weight_02, weight_03, weight_04, weight_05, weight_06,
|
|
weight_07, weight_08, weight_09, weight_10, weight_11, weight_12, flip_weights):
|
|
weights = [weight_00, weight_01, weight_02, weight_03, weight_04, weight_05, weight_06,
|
|
weight_07, weight_08, weight_09, weight_10, weight_11, weight_12]
|
|
weights = ControlWeights.controlnet(weights, flip_weights=flip_weights)
|
|
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_weights=weights)))
|
|
|
|
```
|