Files
2024-06-29 18:50:22 +08:00

66 lines
2.6 KiB
Markdown

---
tags:
- ControlNet
- Weight
---
# T2IAdapter Soft Weights 🛂🅐🅒🅝
## Documentation
- Class name: `SoftT2IAdapterWeights`
- Category: `Adv-ControlNet 🛂🅐🅒🅝/weights/T2IAdapter`
- Output node: `False`
The SoftT2IAdapterWeights node is designed to adjust the influence of control weights within a text-to-image adaptation process, allowing for a more nuanced and customizable image generation based on the specified weights and the option to flip these weights.
## Input types
### Required
- **`weight_i`**
- Specifies a control weight at index 'i', influencing the adaptation process at various stages. The index 'i' represents a sequence of control weights, allowing for detailed customization of the image generation process.
- Comfy dtype: `FLOAT`
- Python dtype: `float`
- **`flip_weights`**
- A boolean flag that, when true, reverses the order of control weights, potentially altering the adaptation process.
- Comfy dtype: `BOOLEAN`
- Python dtype: `bool`
## Output types
- **`CN_WEIGHTS`**
- Comfy dtype: `CONTROL_NET_WEIGHTS`
- The adjusted control weights after processing through the SoftT2IAdapterWeights node.
- Python dtype: `list`
- **`TK_SHORTCUT`**
- Comfy dtype: `TIMESTEP_KEYFRAME`
- A keyframe group indicating specific timesteps where the control weights have significant influence.
- Python dtype: `TimestepKeyframeGroup`
## Usage tips
- Infra type: `CPU`
- Common nodes: unknown
## Source code
```python
class SoftT2IAdapterWeights:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"weight_00": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 10.0, "step": 0.001}, ),
"weight_01": ("FLOAT", {"default": 0.62, "min": 0.0, "max": 10.0, "step": 0.001}, ),
"weight_02": ("FLOAT", {"default": 0.825, "min": 0.0, "max": 10.0, "step": 0.001}, ),
"weight_03": ("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/T2IAdapter"
def load_weights(self, weight_00, weight_01, weight_02, weight_03, flip_weights):
weights = [weight_00, weight_01, weight_02, weight_03]
weights = get_properly_arranged_t2i_weights(weights)
weights = ControlWeights.t2iadapter(weights, flip_weights=flip_weights)
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_weights=weights)))
```