Freak-ppa commited on
Commit
6d5e45b
·
verified ·
1 Parent(s): b33b762

Upload 72 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/.github/FUNDING.yml +4 -0
  2. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/.github/workflows/publish.yml +21 -0
  3. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/.gitignore +4 -0
  4. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/CrossAttentionPatch.py +209 -0
  5. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/IPAdapterPlus.py +1950 -0
  6. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/LICENSE +674 -0
  7. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/NODES.md +54 -0
  8. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/README.md +187 -0
  9. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/__init__.py +19 -0
  10. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/demo_workflow.jpg +0 -0
  11. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_advanced.json +619 -0
  12. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_clipvision_enhancer.json +918 -0
  13. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_combine_embeds.json +1542 -0
  14. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_cosxl_edit.json +1624 -0
  15. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_faceid.json +566 -0
  16. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_faceid_batch.json +1023 -0
  17. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_ideal_faceid_config.json +728 -0
  18. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_kolors.json +680 -0
  19. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_negative_image.json +956 -0
  20. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_noise_injection.json +677 -0
  21. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_portrait.json +567 -0
  22. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_precise_composition.json +861 -0
  23. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_precise_weight_type.json +965 -0
  24. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_regional_conditioning.json +1512 -0
  25. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_simple.json +546 -0
  26. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_style_composition.json +612 -0
  27. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_tiled.json +583 -0
  28. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_weight_types.json +1738 -0
  29. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_weighted_embeds.json +836 -0
  30. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_weights.json +764 -0
  31. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/image_proj_models.py +275 -0
  32. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/models/legacy_directory_do_not_use.txt +0 -0
  33. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/pyproject.toml +14 -0
  34. ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/utils.py +384 -0
  35. ComfyUI/custom_nodes/comfyui_segment_anything/.gitignore +160 -0
  36. ComfyUI/custom_nodes/comfyui_segment_anything/LICENSE +201 -0
  37. ComfyUI/custom_nodes/comfyui_segment_anything/README.md +66 -0
  38. ComfyUI/custom_nodes/comfyui_segment_anything/__init__.py +14 -0
  39. ComfyUI/custom_nodes/comfyui_segment_anything/docs/images/example.jpg +0 -0
  40. ComfyUI/custom_nodes/comfyui_segment_anything/install.py +18 -0
  41. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/datasets/__init__.py +0 -0
  42. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/datasets/transforms.py +311 -0
  43. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/__init__.py +15 -0
  44. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/__init__.py +1 -0
  45. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/backbone.py +221 -0
  46. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/position_encoding.py +186 -0
  47. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/swin_transformer.py +802 -0
  48. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/bertwarper.py +269 -0
  49. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/fuse_modules.py +297 -0
  50. ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/groundingdino.py +385 -0
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/.github/FUNDING.yml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: cubiq
4
+ custom: ['https://www.paypal.com/paypalme/matt3o']
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/.github/workflows/publish.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish to Comfy registry
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - "pyproject.toml"
9
+
10
+ jobs:
11
+ publish-node:
12
+ name: Publish Custom Node to registry
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Check out code
16
+ uses: actions/checkout@v4
17
+ - name: Publish Custom Node
18
+ uses: Comfy-Org/publish-node-action@main
19
+ with:
20
+ ## Add your own personal access token to your Github Repository secrets and reference it here.
21
+ personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ /__pycache__/
2
+ /models/*.bin
3
+ /models/*.safetensors
4
+ .directory
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/CrossAttentionPatch.py ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import math
3
+ import torch.nn.functional as F
4
+ from comfy.ldm.modules.attention import optimized_attention
5
+ from .utils import tensor_to_size
6
+
7
+ class Attn2Replace:
8
+ def __init__(self, callback=None, **kwargs):
9
+ self.callback = [callback]
10
+ self.kwargs = [kwargs]
11
+
12
+ def add(self, callback, **kwargs):
13
+ self.callback.append(callback)
14
+ self.kwargs.append(kwargs)
15
+
16
+ for key, value in kwargs.items():
17
+ setattr(self, key, value)
18
+
19
+ def __call__(self, q, k, v, extra_options):
20
+ dtype = q.dtype
21
+ out = optimized_attention(q, k, v, extra_options["n_heads"])
22
+ sigma = extra_options["sigmas"].detach().cpu()[0].item() if 'sigmas' in extra_options else 999999999.9
23
+
24
+ for i, callback in enumerate(self.callback):
25
+ if sigma <= self.kwargs[i]["sigma_start"] and sigma >= self.kwargs[i]["sigma_end"]:
26
+ out = out + callback(out, q, k, v, extra_options, **self.kwargs[i])
27
+
28
+ return out.to(dtype=dtype)
29
+
30
+ def ipadapter_attention(out, q, k, v, extra_options, module_key='', ipadapter=None, weight=1.0, cond=None, cond_alt=None, uncond=None, weight_type="linear", mask=None, sigma_start=0.0, sigma_end=1.0, unfold_batch=False, embeds_scaling='V only', **kwargs):
31
+ dtype = q.dtype
32
+ cond_or_uncond = extra_options["cond_or_uncond"]
33
+ block_type = extra_options["block"][0]
34
+ #block_id = extra_options["block"][1]
35
+ t_idx = extra_options["transformer_index"]
36
+ layers = 11 if '101_to_k_ip' in ipadapter.ip_layers.to_kvs else 16
37
+ k_key = module_key + "_to_k_ip"
38
+ v_key = module_key + "_to_v_ip"
39
+
40
+ # extra options for AnimateDiff
41
+ ad_params = extra_options['ad_params'] if "ad_params" in extra_options else None
42
+
43
+ b = q.shape[0]
44
+ seq_len = q.shape[1]
45
+ batch_prompt = b // len(cond_or_uncond)
46
+ _, _, oh, ow = extra_options["original_shape"]
47
+
48
+ if weight_type == 'ease in':
49
+ weight = weight * (0.05 + 0.95 * (1 - t_idx / layers))
50
+ elif weight_type == 'ease out':
51
+ weight = weight * (0.05 + 0.95 * (t_idx / layers))
52
+ elif weight_type == 'ease in-out':
53
+ weight = weight * (0.05 + 0.95 * (1 - abs(t_idx - (layers/2)) / (layers/2)))
54
+ elif weight_type == 'reverse in-out':
55
+ weight = weight * (0.05 + 0.95 * (abs(t_idx - (layers/2)) / (layers/2)))
56
+ elif weight_type == 'weak input' and block_type == 'input':
57
+ weight = weight * 0.2
58
+ elif weight_type == 'weak middle' and block_type == 'middle':
59
+ weight = weight * 0.2
60
+ elif weight_type == 'weak output' and block_type == 'output':
61
+ weight = weight * 0.2
62
+ elif weight_type == 'strong middle' and (block_type == 'input' or block_type == 'output'):
63
+ weight = weight * 0.2
64
+ elif isinstance(weight, dict):
65
+ if t_idx not in weight:
66
+ return 0
67
+
68
+ if weight_type == "style transfer precise":
69
+ if layers == 11 and t_idx == 3:
70
+ uncond = cond
71
+ cond = cond * 0
72
+ elif layers == 16 and (t_idx == 4 or t_idx == 5):
73
+ uncond = cond
74
+ cond = cond * 0
75
+ elif weight_type == "composition precise":
76
+ if layers == 11 and t_idx != 3:
77
+ uncond = cond
78
+ cond = cond * 0
79
+ elif layers == 16 and (t_idx != 4 and t_idx != 5):
80
+ uncond = cond
81
+ cond = cond * 0
82
+
83
+ weight = weight[t_idx]
84
+
85
+ if cond_alt is not None and t_idx in cond_alt:
86
+ cond = cond_alt[t_idx]
87
+ del cond_alt
88
+
89
+ if unfold_batch:
90
+ # Check AnimateDiff context window
91
+ if ad_params is not None and ad_params["sub_idxs"] is not None:
92
+ if isinstance(weight, torch.Tensor):
93
+ weight = tensor_to_size(weight, ad_params["full_length"])
94
+ weight = torch.Tensor(weight[ad_params["sub_idxs"]])
95
+ if torch.all(weight == 0):
96
+ return 0
97
+ weight = weight.repeat(len(cond_or_uncond), 1, 1) # repeat for cond and uncond
98
+ elif weight == 0:
99
+ return 0
100
+
101
+ # if image length matches or exceeds full_length get sub_idx images
102
+ if cond.shape[0] >= ad_params["full_length"]:
103
+ cond = torch.Tensor(cond[ad_params["sub_idxs"]])
104
+ uncond = torch.Tensor(uncond[ad_params["sub_idxs"]])
105
+ # otherwise get sub_idxs images
106
+ else:
107
+ cond = tensor_to_size(cond, ad_params["full_length"])
108
+ uncond = tensor_to_size(uncond, ad_params["full_length"])
109
+ cond = cond[ad_params["sub_idxs"]]
110
+ uncond = uncond[ad_params["sub_idxs"]]
111
+ else:
112
+ if isinstance(weight, torch.Tensor):
113
+ weight = tensor_to_size(weight, batch_prompt)
114
+ if torch.all(weight == 0):
115
+ return 0
116
+ weight = weight.repeat(len(cond_or_uncond), 1, 1) # repeat for cond and uncond
117
+ elif weight == 0:
118
+ return 0
119
+
120
+ cond = tensor_to_size(cond, batch_prompt)
121
+ uncond = tensor_to_size(uncond, batch_prompt)
122
+
123
+ k_cond = ipadapter.ip_layers.to_kvs[k_key](cond)
124
+ k_uncond = ipadapter.ip_layers.to_kvs[k_key](uncond)
125
+ v_cond = ipadapter.ip_layers.to_kvs[v_key](cond)
126
+ v_uncond = ipadapter.ip_layers.to_kvs[v_key](uncond)
127
+ else:
128
+ # TODO: should we always convert the weights to a tensor?
129
+ if isinstance(weight, torch.Tensor):
130
+ weight = tensor_to_size(weight, batch_prompt)
131
+ if torch.all(weight == 0):
132
+ return 0
133
+ weight = weight.repeat(len(cond_or_uncond), 1, 1) # repeat for cond and uncond
134
+ elif weight == 0:
135
+ return 0
136
+
137
+ k_cond = ipadapter.ip_layers.to_kvs[k_key](cond).repeat(batch_prompt, 1, 1)
138
+ k_uncond = ipadapter.ip_layers.to_kvs[k_key](uncond).repeat(batch_prompt, 1, 1)
139
+ v_cond = ipadapter.ip_layers.to_kvs[v_key](cond).repeat(batch_prompt, 1, 1)
140
+ v_uncond = ipadapter.ip_layers.to_kvs[v_key](uncond).repeat(batch_prompt, 1, 1)
141
+
142
+ if len(cond_or_uncond) == 3: # TODO: conxl, I need to check this
143
+ ip_k = torch.cat([(k_cond, k_uncond, k_cond)[i] for i in cond_or_uncond], dim=0)
144
+ ip_v = torch.cat([(v_cond, v_uncond, v_cond)[i] for i in cond_or_uncond], dim=0)
145
+ else:
146
+ ip_k = torch.cat([(k_cond, k_uncond)[i] for i in cond_or_uncond], dim=0)
147
+ ip_v = torch.cat([(v_cond, v_uncond)[i] for i in cond_or_uncond], dim=0)
148
+
149
+ if embeds_scaling == 'K+mean(V) w/ C penalty':
150
+ scaling = float(ip_k.shape[2]) / 1280.0
151
+ weight = weight * scaling
152
+ ip_k = ip_k * weight
153
+ ip_v_mean = torch.mean(ip_v, dim=1, keepdim=True)
154
+ ip_v = (ip_v - ip_v_mean) + ip_v_mean * weight
155
+ out_ip = optimized_attention(q, ip_k, ip_v, extra_options["n_heads"])
156
+ del ip_v_mean
157
+ elif embeds_scaling == 'K+V w/ C penalty':
158
+ scaling = float(ip_k.shape[2]) / 1280.0
159
+ weight = weight * scaling
160
+ ip_k = ip_k * weight
161
+ ip_v = ip_v * weight
162
+ out_ip = optimized_attention(q, ip_k, ip_v, extra_options["n_heads"])
163
+ elif embeds_scaling == 'K+V':
164
+ ip_k = ip_k * weight
165
+ ip_v = ip_v * weight
166
+ out_ip = optimized_attention(q, ip_k, ip_v, extra_options["n_heads"])
167
+ else:
168
+ #ip_v = ip_v * weight
169
+ out_ip = optimized_attention(q, ip_k, ip_v, extra_options["n_heads"])
170
+ out_ip = out_ip * weight # I'm doing this to get the same results as before
171
+
172
+ if mask is not None:
173
+ mask_h = oh / math.sqrt(oh * ow / seq_len)
174
+ mask_h = int(mask_h) + int((seq_len % int(mask_h)) != 0)
175
+ mask_w = seq_len // mask_h
176
+
177
+ # check if using AnimateDiff and sliding context window
178
+ if (mask.shape[0] > 1 and ad_params is not None and ad_params["sub_idxs"] is not None):
179
+ # if mask length matches or exceeds full_length, get sub_idx masks
180
+ if mask.shape[0] >= ad_params["full_length"]:
181
+ mask = torch.Tensor(mask[ad_params["sub_idxs"]])
182
+ mask = F.interpolate(mask.unsqueeze(1), size=(mask_h, mask_w), mode="bilinear").squeeze(1)
183
+ else:
184
+ mask = F.interpolate(mask.unsqueeze(1), size=(mask_h, mask_w), mode="bilinear").squeeze(1)
185
+ mask = tensor_to_size(mask, ad_params["full_length"])
186
+ mask = mask[ad_params["sub_idxs"]]
187
+ else:
188
+ mask = F.interpolate(mask.unsqueeze(1), size=(mask_h, mask_w), mode="bilinear").squeeze(1)
189
+ mask = tensor_to_size(mask, batch_prompt)
190
+
191
+ mask = mask.repeat(len(cond_or_uncond), 1, 1)
192
+ mask = mask.view(mask.shape[0], -1, 1).repeat(1, 1, out.shape[2])
193
+
194
+ # covers cases where extreme aspect ratios can cause the mask to have a wrong size
195
+ mask_len = mask_h * mask_w
196
+ if mask_len < seq_len:
197
+ pad_len = seq_len - mask_len
198
+ pad1 = pad_len // 2
199
+ pad2 = pad_len - pad1
200
+ mask = F.pad(mask, (0, 0, pad1, pad2), value=0.0)
201
+ elif mask_len > seq_len:
202
+ crop_start = (mask_len - seq_len) // 2
203
+ mask = mask[:, crop_start:crop_start+seq_len, :]
204
+
205
+ out_ip = out_ip * mask
206
+
207
+ #out = out + out_ip
208
+
209
+ return out_ip.to(dtype=dtype)
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/IPAdapterPlus.py ADDED
@@ -0,0 +1,1950 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import os
3
+ import math
4
+ import folder_paths
5
+
6
+ import comfy.model_management as model_management
7
+ from node_helpers import conditioning_set_values
8
+ from comfy.clip_vision import load as load_clip_vision
9
+ from comfy.sd import load_lora_for_models
10
+ import comfy.utils
11
+
12
+ import torch.nn as nn
13
+ from PIL import Image
14
+ try:
15
+ import torchvision.transforms.v2 as T
16
+ except ImportError:
17
+ import torchvision.transforms as T
18
+
19
+ from .image_proj_models import MLPProjModel, MLPProjModelFaceId, ProjModelFaceIdPlus, Resampler, ImageProjModel
20
+ from .CrossAttentionPatch import Attn2Replace, ipadapter_attention
21
+ from .utils import (
22
+ encode_image_masked,
23
+ tensor_to_size,
24
+ contrast_adaptive_sharpening,
25
+ tensor_to_image,
26
+ image_to_tensor,
27
+ ipadapter_model_loader,
28
+ insightface_loader,
29
+ get_clipvision_file,
30
+ get_ipadapter_file,
31
+ get_lora_file,
32
+ )
33
+
34
+ # set the models directory
35
+ if "ipadapter" not in folder_paths.folder_names_and_paths:
36
+ current_paths = [os.path.join(folder_paths.models_dir, "ipadapter")]
37
+ else:
38
+ current_paths, _ = folder_paths.folder_names_and_paths["ipadapter"]
39
+ folder_paths.folder_names_and_paths["ipadapter"] = (current_paths, folder_paths.supported_pt_extensions)
40
+
41
+ WEIGHT_TYPES = ["linear", "ease in", "ease out", 'ease in-out', 'reverse in-out', 'weak input', 'weak output', 'weak middle', 'strong middle', 'style transfer', 'composition', 'strong style transfer', 'style and composition', 'style transfer precise', 'composition precise']
42
+
43
+ """
44
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+ Main IPAdapter Class
46
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
+ """
48
+ class IPAdapter(nn.Module):
49
+ def __init__(self, ipadapter_model, cross_attention_dim=1024, output_cross_attention_dim=1024, clip_embeddings_dim=1024, clip_extra_context_tokens=4, is_sdxl=False, is_plus=False, is_full=False, is_faceid=False, is_portrait_unnorm=False, is_kwai_kolors=False):
50
+ super().__init__()
51
+
52
+ self.clip_embeddings_dim = clip_embeddings_dim
53
+ self.cross_attention_dim = cross_attention_dim
54
+ self.output_cross_attention_dim = output_cross_attention_dim
55
+ self.clip_extra_context_tokens = clip_extra_context_tokens
56
+ self.is_sdxl = is_sdxl
57
+ self.is_full = is_full
58
+ self.is_plus = is_plus
59
+ self.is_portrait_unnorm = is_portrait_unnorm
60
+ self.is_kwai_kolors = is_kwai_kolors
61
+
62
+ if is_faceid and not is_portrait_unnorm:
63
+ self.image_proj_model = self.init_proj_faceid()
64
+ elif is_full:
65
+ self.image_proj_model = self.init_proj_full()
66
+ elif is_plus or is_portrait_unnorm:
67
+ self.image_proj_model = self.init_proj_plus()
68
+ else:
69
+ self.image_proj_model = self.init_proj()
70
+
71
+ self.image_proj_model.load_state_dict(ipadapter_model["image_proj"])
72
+ self.ip_layers = To_KV(ipadapter_model["ip_adapter"])
73
+
74
+ def init_proj(self):
75
+ image_proj_model = ImageProjModel(
76
+ cross_attention_dim=self.cross_attention_dim,
77
+ clip_embeddings_dim=self.clip_embeddings_dim,
78
+ clip_extra_context_tokens=self.clip_extra_context_tokens
79
+ )
80
+ return image_proj_model
81
+
82
+ def init_proj_plus(self):
83
+ image_proj_model = Resampler(
84
+ dim=self.cross_attention_dim,
85
+ depth=4,
86
+ dim_head=64,
87
+ heads=20 if self.is_sdxl and not self.is_kwai_kolors else 12,
88
+ num_queries=self.clip_extra_context_tokens,
89
+ embedding_dim=self.clip_embeddings_dim,
90
+ output_dim=self.output_cross_attention_dim,
91
+ ff_mult=4
92
+ )
93
+ return image_proj_model
94
+
95
+ def init_proj_full(self):
96
+ image_proj_model = MLPProjModel(
97
+ cross_attention_dim=self.cross_attention_dim,
98
+ clip_embeddings_dim=self.clip_embeddings_dim
99
+ )
100
+ return image_proj_model
101
+
102
+ def init_proj_faceid(self):
103
+ if self.is_plus:
104
+ image_proj_model = ProjModelFaceIdPlus(
105
+ cross_attention_dim=self.cross_attention_dim,
106
+ id_embeddings_dim=512,
107
+ clip_embeddings_dim=self.clip_embeddings_dim, # 1280,
108
+ num_tokens=self.clip_extra_context_tokens, # 4,
109
+ )
110
+ else:
111
+ image_proj_model = MLPProjModelFaceId(
112
+ cross_attention_dim=self.cross_attention_dim,
113
+ id_embeddings_dim=512,
114
+ num_tokens=self.clip_extra_context_tokens,
115
+ )
116
+ return image_proj_model
117
+
118
+ @torch.inference_mode()
119
+ def get_image_embeds(self, clip_embed, clip_embed_zeroed, batch_size):
120
+ torch_device = model_management.get_torch_device()
121
+ intermediate_device = model_management.intermediate_device()
122
+
123
+ if batch_size == 0:
124
+ batch_size = clip_embed.shape[0]
125
+ intermediate_device = torch_device
126
+ elif batch_size > clip_embed.shape[0]:
127
+ batch_size = clip_embed.shape[0]
128
+
129
+ clip_embed = torch.split(clip_embed, batch_size, dim=0)
130
+ clip_embed_zeroed = torch.split(clip_embed_zeroed, batch_size, dim=0)
131
+
132
+ image_prompt_embeds = []
133
+ uncond_image_prompt_embeds = []
134
+
135
+ for ce, cez in zip(clip_embed, clip_embed_zeroed):
136
+ image_prompt_embeds.append(self.image_proj_model(ce.to(torch_device)).to(intermediate_device))
137
+ uncond_image_prompt_embeds.append(self.image_proj_model(cez.to(torch_device)).to(intermediate_device))
138
+
139
+ del clip_embed, clip_embed_zeroed
140
+
141
+ image_prompt_embeds = torch.cat(image_prompt_embeds, dim=0)
142
+ uncond_image_prompt_embeds = torch.cat(uncond_image_prompt_embeds, dim=0)
143
+
144
+ torch.cuda.empty_cache()
145
+
146
+ #image_prompt_embeds = self.image_proj_model(clip_embed)
147
+ #uncond_image_prompt_embeds = self.image_proj_model(clip_embed_zeroed)
148
+ return image_prompt_embeds, uncond_image_prompt_embeds
149
+
150
+ @torch.inference_mode()
151
+ def get_image_embeds_faceid_plus(self, face_embed, clip_embed, s_scale, shortcut, batch_size):
152
+ torch_device = model_management.get_torch_device()
153
+ intermediate_device = model_management.intermediate_device()
154
+
155
+ if batch_size == 0:
156
+ batch_size = clip_embed.shape[0]
157
+ intermediate_device = torch_device
158
+ elif batch_size > clip_embed.shape[0]:
159
+ batch_size = clip_embed.shape[0]
160
+
161
+ face_embed_batch = torch.split(face_embed, batch_size, dim=0)
162
+ clip_embed_batch = torch.split(clip_embed, batch_size, dim=0)
163
+
164
+ embeds = []
165
+ for face_embed, clip_embed in zip(face_embed_batch, clip_embed_batch):
166
+ embeds.append(self.image_proj_model(face_embed.to(torch_device), clip_embed.to(torch_device), scale=s_scale, shortcut=shortcut).to(intermediate_device))
167
+
168
+ del face_embed_batch, clip_embed_batch
169
+
170
+ embeds = torch.cat(embeds, dim=0)
171
+ torch.cuda.empty_cache()
172
+ #embeds = self.image_proj_model(face_embed, clip_embed, scale=s_scale, shortcut=shortcut)
173
+ return embeds
174
+
175
+ class To_KV(nn.Module):
176
+ def __init__(self, state_dict):
177
+ super().__init__()
178
+
179
+ self.to_kvs = nn.ModuleDict()
180
+ for key, value in state_dict.items():
181
+ self.to_kvs[key.replace(".weight", "").replace(".", "_")] = nn.Linear(value.shape[1], value.shape[0], bias=False)
182
+ self.to_kvs[key.replace(".weight", "").replace(".", "_")].weight.data = value
183
+
184
+ def set_model_patch_replace(model, patch_kwargs, key):
185
+ to = model.model_options["transformer_options"].copy()
186
+ if "patches_replace" not in to:
187
+ to["patches_replace"] = {}
188
+ else:
189
+ to["patches_replace"] = to["patches_replace"].copy()
190
+
191
+ if "attn2" not in to["patches_replace"]:
192
+ to["patches_replace"]["attn2"] = {}
193
+ else:
194
+ to["patches_replace"]["attn2"] = to["patches_replace"]["attn2"].copy()
195
+
196
+ if key not in to["patches_replace"]["attn2"]:
197
+ to["patches_replace"]["attn2"][key] = Attn2Replace(ipadapter_attention, **patch_kwargs)
198
+ model.model_options["transformer_options"] = to
199
+ else:
200
+ to["patches_replace"]["attn2"][key].add(ipadapter_attention, **patch_kwargs)
201
+
202
+ def ipadapter_execute(model,
203
+ ipadapter,
204
+ clipvision,
205
+ insightface=None,
206
+ image=None,
207
+ image_composition=None,
208
+ image_negative=None,
209
+ weight=1.0,
210
+ weight_composition=1.0,
211
+ weight_faceidv2=None,
212
+ weight_type="linear",
213
+ combine_embeds="concat",
214
+ start_at=0.0,
215
+ end_at=1.0,
216
+ attn_mask=None,
217
+ pos_embed=None,
218
+ neg_embed=None,
219
+ unfold_batch=False,
220
+ embeds_scaling='V only',
221
+ layer_weights=None,
222
+ encode_batch_size=0,
223
+ style_boost=None,
224
+ composition_boost=None,
225
+ enhance_tiles=1,
226
+ enhance_ratio=1.0,):
227
+ device = model_management.get_torch_device()
228
+ dtype = model_management.unet_dtype()
229
+ if dtype not in [torch.float32, torch.float16, torch.bfloat16]:
230
+ dtype = torch.float16 if model_management.should_use_fp16() else torch.float32
231
+
232
+ is_full = "proj.3.weight" in ipadapter["image_proj"]
233
+ is_portrait = "proj.2.weight" in ipadapter["image_proj"] and not "proj.3.weight" in ipadapter["image_proj"] and not "0.to_q_lora.down.weight" in ipadapter["ip_adapter"]
234
+ is_portrait_unnorm = "portraitunnorm" in ipadapter
235
+ is_faceid = is_portrait or "0.to_q_lora.down.weight" in ipadapter["ip_adapter"] or is_portrait_unnorm
236
+ is_plus = (is_full or "latents" in ipadapter["image_proj"] or "perceiver_resampler.proj_in.weight" in ipadapter["image_proj"]) and not is_portrait_unnorm
237
+ is_faceidv2 = "faceidplusv2" in ipadapter
238
+ output_cross_attention_dim = ipadapter["ip_adapter"]["1.to_k_ip.weight"].shape[1]
239
+ is_sdxl = output_cross_attention_dim == 2048
240
+ is_kwai_kolors = is_sdxl and "layers.0.0.to_out.weight" in ipadapter["image_proj"] and ipadapter["image_proj"]["layers.0.0.to_out.weight"].shape[0] == 2048
241
+
242
+ if is_faceid and not insightface:
243
+ raise Exception("insightface model is required for FaceID models")
244
+
245
+ if is_faceidv2:
246
+ weight_faceidv2 = weight_faceidv2 if weight_faceidv2 is not None else weight*2
247
+
248
+ cross_attention_dim = 1280 if (is_plus and is_sdxl and not is_faceid and not is_kwai_kolors) or is_portrait_unnorm else output_cross_attention_dim
249
+ clip_extra_context_tokens = 16 if (is_plus and not is_faceid) or is_portrait or is_portrait_unnorm else 4
250
+
251
+ if image is not None and image.shape[1] != image.shape[2]:
252
+ print("\033[33mINFO: the IPAdapter reference image is not a square, CLIPImageProcessor will resize and crop it at the center. If the main focus of the picture is not in the middle the result might not be what you are expecting.\033[0m")
253
+
254
+ if isinstance(weight, list):
255
+ weight = torch.tensor(weight).unsqueeze(-1).unsqueeze(-1).to(device, dtype=dtype) if unfold_batch else weight[0]
256
+
257
+ if style_boost is not None:
258
+ weight_type = "style transfer precise"
259
+ elif composition_boost is not None:
260
+ weight_type = "composition precise"
261
+
262
+ # special weight types
263
+ if layer_weights is not None and layer_weights != '':
264
+ weight = { int(k): float(v)*weight for k, v in [x.split(":") for x in layer_weights.split(",")] }
265
+ weight_type = weight_type if weight_type == "style transfer precise" or weight_type == "composition precise" else "linear"
266
+ elif weight_type == "style transfer":
267
+ weight = { 6:weight } if is_sdxl else { 0:weight, 1:weight, 2:weight, 3:weight, 9:weight, 10:weight, 11:weight, 12:weight, 13:weight, 14:weight, 15:weight }
268
+ elif weight_type == "composition":
269
+ weight = { 3:weight } if is_sdxl else { 4:weight*0.25, 5:weight }
270
+ elif weight_type == "strong style transfer":
271
+ if is_sdxl:
272
+ weight = { 0:weight, 1:weight, 2:weight, 4:weight, 5:weight, 6:weight, 7:weight, 8:weight, 9:weight, 10:weight }
273
+ else:
274
+ weight = { 0:weight, 1:weight, 2:weight, 3:weight, 6:weight, 7:weight, 8:weight, 9:weight, 10:weight, 11:weight, 12:weight, 13:weight, 14:weight, 15:weight }
275
+ elif weight_type == "style and composition":
276
+ if is_sdxl:
277
+ weight = { 3:weight_composition, 6:weight }
278
+ else:
279
+ weight = { 0:weight, 1:weight, 2:weight, 3:weight, 4:weight_composition*0.25, 5:weight_composition, 9:weight, 10:weight, 11:weight, 12:weight, 13:weight, 14:weight, 15:weight }
280
+ elif weight_type == "strong style and composition":
281
+ if is_sdxl:
282
+ weight = { 0:weight, 1:weight, 2:weight, 3:weight_composition, 4:weight, 5:weight, 6:weight, 7:weight, 8:weight, 9:weight, 10:weight }
283
+ else:
284
+ weight = { 0:weight, 1:weight, 2:weight, 3:weight, 4:weight_composition, 5:weight_composition, 6:weight, 7:weight, 8:weight, 9:weight, 10:weight, 11:weight, 12:weight, 13:weight, 14:weight, 15:weight }
285
+ elif weight_type == "style transfer precise":
286
+ weight_composition = style_boost if style_boost is not None else weight
287
+ if is_sdxl:
288
+ weight = { 3:weight_composition, 6:weight }
289
+ else:
290
+ weight = { 0:weight, 1:weight, 2:weight, 3:weight, 4:weight_composition*0.25, 5:weight_composition, 9:weight, 10:weight, 11:weight, 12:weight, 13:weight, 14:weight, 15:weight }
291
+ elif weight_type == "composition precise":
292
+ weight_composition = weight
293
+ weight = composition_boost if composition_boost is not None else weight
294
+ if is_sdxl:
295
+ weight = { 0:weight*.1, 1:weight*.1, 2:weight*.1, 3:weight_composition, 4:weight*.1, 5:weight*.1, 6:weight, 7:weight*.1, 8:weight*.1, 9:weight*.1, 10:weight*.1 }
296
+ else:
297
+ weight = { 0:weight, 1:weight, 2:weight, 3:weight, 4:weight_composition*0.25, 5:weight_composition, 6:weight*.1, 7:weight*.1, 8:weight*.1, 9:weight, 10:weight, 11:weight, 12:weight, 13:weight, 14:weight, 15:weight }
298
+
299
+ clipvision_size=224 if not is_kwai_kolors else 336
300
+
301
+ img_comp_cond_embeds = None
302
+ face_cond_embeds = None
303
+ if is_faceid:
304
+ if insightface is None:
305
+ raise Exception("Insightface model is required for FaceID models")
306
+
307
+ from insightface.utils import face_align
308
+
309
+ insightface.det_model.input_size = (640,640) # reset the detection size
310
+ image_iface = tensor_to_image(image)
311
+ face_cond_embeds = []
312
+ image = []
313
+
314
+ for i in range(image_iface.shape[0]):
315
+ for size in [(size, size) for size in range(640, 256, -64)]:
316
+ insightface.det_model.input_size = size # TODO: hacky but seems to be working
317
+ face = insightface.get(image_iface[i])
318
+ if face:
319
+ if not is_portrait_unnorm:
320
+ face_cond_embeds.append(torch.from_numpy(face[0].normed_embedding).unsqueeze(0))
321
+ else:
322
+ face_cond_embeds.append(torch.from_numpy(face[0].embedding).unsqueeze(0))
323
+ image.append(image_to_tensor(face_align.norm_crop(image_iface[i], landmark=face[0].kps, image_size=256 if is_sdxl else 224)))
324
+
325
+ if 640 not in size:
326
+ print(f"\033[33mINFO: InsightFace detection resolution lowered to {size}.\033[0m")
327
+ break
328
+ else:
329
+ raise Exception('InsightFace: No face detected.')
330
+ face_cond_embeds = torch.stack(face_cond_embeds).to(device, dtype=dtype)
331
+ image = torch.stack(image)
332
+ del image_iface, face
333
+
334
+
335
+ if image is not None:
336
+ img_cond_embeds = encode_image_masked(clipvision, image, batch_size=encode_batch_size, tiles=enhance_tiles, ratio=enhance_ratio, clipvision_size=clipvision_size)
337
+ if image_composition is not None:
338
+ img_comp_cond_embeds = encode_image_masked(clipvision, image_composition, batch_size=encode_batch_size, tiles=enhance_tiles, ratio=enhance_ratio, clipvision_size=clipvision_size)
339
+
340
+ if is_plus:
341
+ img_cond_embeds = img_cond_embeds.penultimate_hidden_states
342
+ image_negative = image_negative if image_negative is not None else torch.zeros([1, clipvision_size, clipvision_size, 3])
343
+ img_uncond_embeds = encode_image_masked(clipvision, image_negative, batch_size=encode_batch_size, clipvision_size=clipvision_size).penultimate_hidden_states
344
+ if image_composition is not None:
345
+ img_comp_cond_embeds = img_comp_cond_embeds.penultimate_hidden_states
346
+ else:
347
+ img_cond_embeds = img_cond_embeds.image_embeds if not is_faceid else face_cond_embeds
348
+ if image_negative is not None and not is_faceid:
349
+ img_uncond_embeds = encode_image_masked(clipvision, image_negative, batch_size=encode_batch_size, clipvision_size=clipvision_size).image_embeds
350
+ else:
351
+ img_uncond_embeds = torch.zeros_like(img_cond_embeds)
352
+ if image_composition is not None:
353
+ img_comp_cond_embeds = img_comp_cond_embeds.image_embeds
354
+ del image_negative, image_composition
355
+
356
+ image = None if not is_faceid else image # if it's face_id we need the cropped face for later
357
+ elif pos_embed is not None:
358
+ img_cond_embeds = pos_embed
359
+
360
+ if neg_embed is not None:
361
+ img_uncond_embeds = neg_embed
362
+ else:
363
+ if is_plus:
364
+ img_uncond_embeds = encode_image_masked(clipvision, torch.zeros([1, clipvision_size, clipvision_size, 3]), clipvision_size=clipvision_size).penultimate_hidden_states
365
+ else:
366
+ img_uncond_embeds = torch.zeros_like(img_cond_embeds)
367
+ del pos_embed, neg_embed
368
+ else:
369
+ raise Exception("Images or Embeds are required")
370
+
371
+ # ensure that cond and uncond have the same batch size
372
+ img_uncond_embeds = tensor_to_size(img_uncond_embeds, img_cond_embeds.shape[0])
373
+
374
+ img_cond_embeds = img_cond_embeds.to(device, dtype=dtype)
375
+ img_uncond_embeds = img_uncond_embeds.to(device, dtype=dtype)
376
+ if img_comp_cond_embeds is not None:
377
+ img_comp_cond_embeds = img_comp_cond_embeds.to(device, dtype=dtype)
378
+
379
+ # combine the embeddings if needed
380
+ if combine_embeds != "concat" and img_cond_embeds.shape[0] > 1 and not unfold_batch:
381
+ if combine_embeds == "add":
382
+ img_cond_embeds = torch.sum(img_cond_embeds, dim=0).unsqueeze(0)
383
+ if face_cond_embeds is not None:
384
+ face_cond_embeds = torch.sum(face_cond_embeds, dim=0).unsqueeze(0)
385
+ if img_comp_cond_embeds is not None:
386
+ img_comp_cond_embeds = torch.sum(img_comp_cond_embeds, dim=0).unsqueeze(0)
387
+ elif combine_embeds == "subtract":
388
+ img_cond_embeds = img_cond_embeds[0] - torch.mean(img_cond_embeds[1:], dim=0)
389
+ img_cond_embeds = img_cond_embeds.unsqueeze(0)
390
+ if face_cond_embeds is not None:
391
+ face_cond_embeds = face_cond_embeds[0] - torch.mean(face_cond_embeds[1:], dim=0)
392
+ face_cond_embeds = face_cond_embeds.unsqueeze(0)
393
+ if img_comp_cond_embeds is not None:
394
+ img_comp_cond_embeds = img_comp_cond_embeds[0] - torch.mean(img_comp_cond_embeds[1:], dim=0)
395
+ img_comp_cond_embeds = img_comp_cond_embeds.unsqueeze(0)
396
+ elif combine_embeds == "average":
397
+ img_cond_embeds = torch.mean(img_cond_embeds, dim=0).unsqueeze(0)
398
+ if face_cond_embeds is not None:
399
+ face_cond_embeds = torch.mean(face_cond_embeds, dim=0).unsqueeze(0)
400
+ if img_comp_cond_embeds is not None:
401
+ img_comp_cond_embeds = torch.mean(img_comp_cond_embeds, dim=0).unsqueeze(0)
402
+ elif combine_embeds == "norm average":
403
+ img_cond_embeds = torch.mean(img_cond_embeds / torch.norm(img_cond_embeds, dim=0, keepdim=True), dim=0).unsqueeze(0)
404
+ if face_cond_embeds is not None:
405
+ face_cond_embeds = torch.mean(face_cond_embeds / torch.norm(face_cond_embeds, dim=0, keepdim=True), dim=0).unsqueeze(0)
406
+ if img_comp_cond_embeds is not None:
407
+ img_comp_cond_embeds = torch.mean(img_comp_cond_embeds / torch.norm(img_comp_cond_embeds, dim=0, keepdim=True), dim=0).unsqueeze(0)
408
+ img_uncond_embeds = img_uncond_embeds[0].unsqueeze(0) # TODO: better strategy for uncond could be to average them
409
+
410
+ if attn_mask is not None:
411
+ attn_mask = attn_mask.to(device, dtype=dtype)
412
+
413
+ ipa = IPAdapter(
414
+ ipadapter,
415
+ cross_attention_dim=cross_attention_dim,
416
+ output_cross_attention_dim=output_cross_attention_dim,
417
+ clip_embeddings_dim=img_cond_embeds.shape[-1],
418
+ clip_extra_context_tokens=clip_extra_context_tokens,
419
+ is_sdxl=is_sdxl,
420
+ is_plus=is_plus,
421
+ is_full=is_full,
422
+ is_faceid=is_faceid,
423
+ is_portrait_unnorm=is_portrait_unnorm,
424
+ is_kwai_kolors=is_kwai_kolors,
425
+ ).to(device, dtype=dtype)
426
+
427
+ if is_faceid and is_plus:
428
+ cond = ipa.get_image_embeds_faceid_plus(face_cond_embeds, img_cond_embeds, weight_faceidv2, is_faceidv2, encode_batch_size)
429
+ # TODO: check if noise helps with the uncond face embeds
430
+ uncond = ipa.get_image_embeds_faceid_plus(torch.zeros_like(face_cond_embeds), img_uncond_embeds, weight_faceidv2, is_faceidv2, encode_batch_size)
431
+ else:
432
+ cond, uncond = ipa.get_image_embeds(img_cond_embeds, img_uncond_embeds, encode_batch_size)
433
+ if img_comp_cond_embeds is not None:
434
+ cond_comp = ipa.get_image_embeds(img_comp_cond_embeds, img_uncond_embeds, encode_batch_size)[0]
435
+
436
+ cond = cond.to(device, dtype=dtype)
437
+ uncond = uncond.to(device, dtype=dtype)
438
+
439
+ cond_alt = None
440
+ if img_comp_cond_embeds is not None:
441
+ cond_alt = { 3: cond_comp.to(device, dtype=dtype) }
442
+
443
+ del img_cond_embeds, img_uncond_embeds, img_comp_cond_embeds, face_cond_embeds
444
+
445
+ sigma_start = model.get_model_object("model_sampling").percent_to_sigma(start_at)
446
+ sigma_end = model.get_model_object("model_sampling").percent_to_sigma(end_at)
447
+
448
+ patch_kwargs = {
449
+ "ipadapter": ipa,
450
+ "weight": weight,
451
+ "cond": cond,
452
+ "cond_alt": cond_alt,
453
+ "uncond": uncond,
454
+ "weight_type": weight_type,
455
+ "mask": attn_mask,
456
+ "sigma_start": sigma_start,
457
+ "sigma_end": sigma_end,
458
+ "unfold_batch": unfold_batch,
459
+ "embeds_scaling": embeds_scaling,
460
+ }
461
+
462
+ number = 0
463
+ if not is_sdxl:
464
+ for id in [1,2,4,5,7,8]: # id of input_blocks that have cross attention
465
+ patch_kwargs["module_key"] = str(number*2+1)
466
+ set_model_patch_replace(model, patch_kwargs, ("input", id))
467
+ number += 1
468
+ for id in [3,4,5,6,7,8,9,10,11]: # id of output_blocks that have cross attention
469
+ patch_kwargs["module_key"] = str(number*2+1)
470
+ set_model_patch_replace(model, patch_kwargs, ("output", id))
471
+ number += 1
472
+ patch_kwargs["module_key"] = str(number*2+1)
473
+ set_model_patch_replace(model, patch_kwargs, ("middle", 0))
474
+ else:
475
+ for id in [4,5,7,8]: # id of input_blocks that have cross attention
476
+ block_indices = range(2) if id in [4, 5] else range(10) # transformer_depth
477
+ for index in block_indices:
478
+ patch_kwargs["module_key"] = str(number*2+1)
479
+ set_model_patch_replace(model, patch_kwargs, ("input", id, index))
480
+ number += 1
481
+ for id in range(6): # id of output_blocks that have cross attention
482
+ block_indices = range(2) if id in [3, 4, 5] else range(10) # transformer_depth
483
+ for index in block_indices:
484
+ patch_kwargs["module_key"] = str(number*2+1)
485
+ set_model_patch_replace(model, patch_kwargs, ("output", id, index))
486
+ number += 1
487
+ for index in range(10):
488
+ patch_kwargs["module_key"] = str(number*2+1)
489
+ set_model_patch_replace(model, patch_kwargs, ("middle", 0, index))
490
+ number += 1
491
+
492
+ return (model, image)
493
+
494
+ """
495
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
496
+ Loaders
497
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
498
+ """
499
+ class IPAdapterUnifiedLoader:
500
+ def __init__(self):
501
+ self.lora = None
502
+ self.clipvision = { "file": None, "model": None }
503
+ self.ipadapter = { "file": None, "model": None }
504
+ self.insightface = { "provider": None, "model": None }
505
+
506
+ @classmethod
507
+ def INPUT_TYPES(s):
508
+ return {"required": {
509
+ "model": ("MODEL", ),
510
+ "preset": (['LIGHT - SD1.5 only (low strength)', 'STANDARD (medium strength)', 'VIT-G (medium strength)', 'PLUS (high strength)', 'PLUS FACE (portraits)', 'FULL FACE - SD1.5 only (portraits stronger)'], ),
511
+ },
512
+ "optional": {
513
+ "ipadapter": ("IPADAPTER", ),
514
+ }}
515
+
516
+ RETURN_TYPES = ("MODEL", "IPADAPTER", )
517
+ RETURN_NAMES = ("model", "ipadapter", )
518
+ FUNCTION = "load_models"
519
+ CATEGORY = "ipadapter"
520
+
521
+ def load_models(self, model, preset, lora_strength=0.0, provider="CPU", ipadapter=None):
522
+ pipeline = { "clipvision": { 'file': None, 'model': None }, "ipadapter": { 'file': None, 'model': None }, "insightface": { 'provider': None, 'model': None } }
523
+ if ipadapter is not None:
524
+ pipeline = ipadapter
525
+
526
+ # 1. Load the clipvision model
527
+ clipvision_file = get_clipvision_file(preset)
528
+ if clipvision_file is None:
529
+ raise Exception("ClipVision model not found.")
530
+
531
+ if clipvision_file != self.clipvision['file']:
532
+ if clipvision_file != pipeline['clipvision']['file']:
533
+ self.clipvision['file'] = clipvision_file
534
+ self.clipvision['model'] = load_clip_vision(clipvision_file)
535
+ print(f"\033[33mINFO: Clip Vision model loaded from {clipvision_file}\033[0m")
536
+ else:
537
+ self.clipvision = pipeline['clipvision']
538
+
539
+ # 2. Load the ipadapter model
540
+ is_sdxl = isinstance(model.model, (comfy.model_base.SDXL, comfy.model_base.SDXLRefiner, comfy.model_base.SDXL_instructpix2pix))
541
+ ipadapter_file, is_insightface, lora_pattern = get_ipadapter_file(preset, is_sdxl)
542
+ if ipadapter_file is None:
543
+ raise Exception("IPAdapter model not found.")
544
+
545
+ if ipadapter_file != self.ipadapter['file']:
546
+ if pipeline['ipadapter']['file'] != ipadapter_file:
547
+ self.ipadapter['file'] = ipadapter_file
548
+ self.ipadapter['model'] = ipadapter_model_loader(ipadapter_file)
549
+ print(f"\033[33mINFO: IPAdapter model loaded from {ipadapter_file}\033[0m")
550
+ else:
551
+ self.ipadapter = pipeline['ipadapter']
552
+
553
+ # 3. Load the lora model if needed
554
+ if lora_pattern is not None:
555
+ lora_file = get_lora_file(lora_pattern)
556
+ lora_model = None
557
+ if lora_file is None:
558
+ raise Exception("LoRA model not found.")
559
+
560
+ if self.lora is not None:
561
+ if lora_file == self.lora['file']:
562
+ lora_model = self.lora['model']
563
+ else:
564
+ self.lora = None
565
+ torch.cuda.empty_cache()
566
+
567
+ if lora_model is None:
568
+ lora_model = comfy.utils.load_torch_file(lora_file, safe_load=True)
569
+ self.lora = { 'file': lora_file, 'model': lora_model }
570
+ print(f"\033[33mINFO: LoRA model loaded from {lora_file}\033[0m")
571
+
572
+ if lora_strength > 0:
573
+ model, _ = load_lora_for_models(model, None, lora_model, lora_strength, 0)
574
+
575
+ # 4. Load the insightface model if needed
576
+ if is_insightface:
577
+ if provider != self.insightface['provider']:
578
+ if pipeline['insightface']['provider'] != provider:
579
+ self.insightface['provider'] = provider
580
+ self.insightface['model'] = insightface_loader(provider)
581
+ print(f"\033[33mINFO: InsightFace model loaded with {provider} provider\033[0m")
582
+ else:
583
+ self.insightface = pipeline['insightface']
584
+
585
+ return (model, { 'clipvision': self.clipvision, 'ipadapter': self.ipadapter, 'insightface': self.insightface }, )
586
+
587
+ class IPAdapterUnifiedLoaderFaceID(IPAdapterUnifiedLoader):
588
+ @classmethod
589
+ def INPUT_TYPES(s):
590
+ return {"required": {
591
+ "model": ("MODEL", ),
592
+ "preset": (['FACEID', 'FACEID PLUS - SD1.5 only', 'FACEID PLUS V2', 'FACEID PORTRAIT (style transfer)', 'FACEID PORTRAIT UNNORM - SDXL only (strong)'], ),
593
+ "lora_strength": ("FLOAT", { "default": 0.6, "min": 0, "max": 1, "step": 0.01 }),
594
+ "provider": (["CPU", "CUDA", "ROCM", "DirectML", "OpenVINO", "CoreML"], ),
595
+ },
596
+ "optional": {
597
+ "ipadapter": ("IPADAPTER", ),
598
+ }}
599
+
600
+ RETURN_NAMES = ("MODEL", "ipadapter", )
601
+ CATEGORY = "ipadapter/faceid"
602
+
603
+ class IPAdapterUnifiedLoaderCommunity(IPAdapterUnifiedLoader):
604
+ @classmethod
605
+ def INPUT_TYPES(s):
606
+ return {"required": {
607
+ "model": ("MODEL", ),
608
+ "preset": (['Composition', 'Kolors'], ),
609
+ },
610
+ "optional": {
611
+ "ipadapter": ("IPADAPTER", ),
612
+ }}
613
+
614
+ CATEGORY = "ipadapter/loaders"
615
+
616
+ class IPAdapterModelLoader:
617
+ @classmethod
618
+ def INPUT_TYPES(s):
619
+ return {"required": { "ipadapter_file": (folder_paths.get_filename_list("ipadapter"), )}}
620
+
621
+ RETURN_TYPES = ("IPADAPTER",)
622
+ FUNCTION = "load_ipadapter_model"
623
+ CATEGORY = "ipadapter/loaders"
624
+
625
+ def load_ipadapter_model(self, ipadapter_file):
626
+ ipadapter_file = folder_paths.get_full_path("ipadapter", ipadapter_file)
627
+ return (ipadapter_model_loader(ipadapter_file),)
628
+
629
+ class IPAdapterInsightFaceLoader:
630
+ @classmethod
631
+ def INPUT_TYPES(s):
632
+ return {
633
+ "required": {
634
+ "provider": (["CPU", "CUDA", "ROCM"], ),
635
+ },
636
+ }
637
+
638
+ RETURN_TYPES = ("INSIGHTFACE",)
639
+ FUNCTION = "load_insightface"
640
+ CATEGORY = "ipadapter/loaders"
641
+
642
+ def load_insightface(self, provider):
643
+ return (insightface_loader(provider),)
644
+
645
+ """
646
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
647
+ Main Apply Nodes
648
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649
+ """
650
+ class IPAdapterSimple:
651
+ @classmethod
652
+ def INPUT_TYPES(s):
653
+ return {
654
+ "required": {
655
+ "model": ("MODEL", ),
656
+ "ipadapter": ("IPADAPTER", ),
657
+ "image": ("IMAGE",),
658
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 3, "step": 0.05 }),
659
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
660
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
661
+ "weight_type": (['standard', 'prompt is more important', 'style transfer'], ),
662
+ },
663
+ "optional": {
664
+ "attn_mask": ("MASK",),
665
+ }
666
+ }
667
+
668
+ RETURN_TYPES = ("MODEL",)
669
+ FUNCTION = "apply_ipadapter"
670
+ CATEGORY = "ipadapter"
671
+
672
+ def apply_ipadapter(self, model, ipadapter, image, weight, start_at, end_at, weight_type, attn_mask=None):
673
+ if weight_type.startswith("style"):
674
+ weight_type = "style transfer"
675
+ elif weight_type == "prompt is more important":
676
+ weight_type = "ease out"
677
+ else:
678
+ weight_type = "linear"
679
+
680
+ ipa_args = {
681
+ "image": image,
682
+ "weight": weight,
683
+ "start_at": start_at,
684
+ "end_at": end_at,
685
+ "attn_mask": attn_mask,
686
+ "weight_type": weight_type,
687
+ "insightface": ipadapter['insightface']['model'] if 'insightface' in ipadapter else None,
688
+ }
689
+
690
+ if 'ipadapter' not in ipadapter:
691
+ raise Exception("IPAdapter model not present in the pipeline. Please load the models with the IPAdapterUnifiedLoader node.")
692
+ if 'clipvision' not in ipadapter:
693
+ raise Exception("CLIPVision model not present in the pipeline. Please load the models with the IPAdapterUnifiedLoader node.")
694
+
695
+ return ipadapter_execute(model.clone(), ipadapter['ipadapter']['model'], ipadapter['clipvision']['model'], **ipa_args)
696
+
697
+ class IPAdapterAdvanced:
698
+ def __init__(self):
699
+ self.unfold_batch = False
700
+
701
+ @classmethod
702
+ def INPUT_TYPES(s):
703
+ return {
704
+ "required": {
705
+ "model": ("MODEL", ),
706
+ "ipadapter": ("IPADAPTER", ),
707
+ "image": ("IMAGE",),
708
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
709
+ "weight_type": (WEIGHT_TYPES, ),
710
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
711
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
712
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
713
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
714
+ },
715
+ "optional": {
716
+ "image_negative": ("IMAGE",),
717
+ "attn_mask": ("MASK",),
718
+ "clip_vision": ("CLIP_VISION",),
719
+ }
720
+ }
721
+
722
+ RETURN_TYPES = ("MODEL",)
723
+ FUNCTION = "apply_ipadapter"
724
+ CATEGORY = "ipadapter"
725
+
726
+ def apply_ipadapter(self, model, ipadapter, start_at=0.0, end_at=1.0, weight=1.0, weight_style=1.0, weight_composition=1.0, expand_style=False, weight_type="linear", combine_embeds="concat", weight_faceidv2=None, image=None, image_style=None, image_composition=None, image_negative=None, clip_vision=None, attn_mask=None, insightface=None, embeds_scaling='V only', layer_weights=None, ipadapter_params=None, encode_batch_size=0, style_boost=None, composition_boost=None, enhance_tiles=1, enhance_ratio=1.0):
727
+ is_sdxl = isinstance(model.model, (comfy.model_base.SDXL, comfy.model_base.SDXLRefiner, comfy.model_base.SDXL_instructpix2pix))
728
+
729
+ if 'ipadapter' in ipadapter:
730
+ ipadapter_model = ipadapter['ipadapter']['model']
731
+ clip_vision = clip_vision if clip_vision is not None else ipadapter['clipvision']['model']
732
+ else:
733
+ ipadapter_model = ipadapter
734
+
735
+ if clip_vision is None:
736
+ raise Exception("Missing CLIPVision model.")
737
+
738
+ if image_style is not None: # we are doing style + composition transfer
739
+ if not is_sdxl:
740
+ raise Exception("Style + Composition transfer is only available for SDXL models at the moment.") # TODO: check feasibility for SD1.5 models
741
+
742
+ image = image_style
743
+ weight = weight_style
744
+ if image_composition is None:
745
+ image_composition = image_style
746
+
747
+ weight_type = "strong style and composition" if expand_style else "style and composition"
748
+ if ipadapter_params is not None: # we are doing batch processing
749
+ image = ipadapter_params['image']
750
+ attn_mask = ipadapter_params['attn_mask']
751
+ weight = ipadapter_params['weight']
752
+ weight_type = ipadapter_params['weight_type']
753
+ start_at = ipadapter_params['start_at']
754
+ end_at = ipadapter_params['end_at']
755
+ else:
756
+ # at this point weight can be a list from the batch-weight or a single float
757
+ weight = [weight]
758
+
759
+ image = image if isinstance(image, list) else [image]
760
+
761
+ work_model = model.clone()
762
+
763
+ for i in range(len(image)):
764
+ if image[i] is None:
765
+ continue
766
+
767
+ ipa_args = {
768
+ "image": image[i],
769
+ "image_composition": image_composition,
770
+ "image_negative": image_negative,
771
+ "weight": weight[i],
772
+ "weight_composition": weight_composition,
773
+ "weight_faceidv2": weight_faceidv2,
774
+ "weight_type": weight_type if not isinstance(weight_type, list) else weight_type[i],
775
+ "combine_embeds": combine_embeds,
776
+ "start_at": start_at if not isinstance(start_at, list) else start_at[i],
777
+ "end_at": end_at if not isinstance(end_at, list) else end_at[i],
778
+ "attn_mask": attn_mask if not isinstance(attn_mask, list) else attn_mask[i],
779
+ "unfold_batch": self.unfold_batch,
780
+ "embeds_scaling": embeds_scaling,
781
+ "insightface": insightface if insightface is not None else ipadapter['insightface']['model'] if 'insightface' in ipadapter else None,
782
+ "layer_weights": layer_weights,
783
+ "encode_batch_size": encode_batch_size,
784
+ "style_boost": style_boost,
785
+ "composition_boost": composition_boost,
786
+ "enhance_tiles": enhance_tiles,
787
+ "enhance_ratio": enhance_ratio,
788
+ }
789
+
790
+ work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, **ipa_args)
791
+
792
+ del ipadapter
793
+ return (work_model, face_image, )
794
+
795
+ class IPAdapterBatch(IPAdapterAdvanced):
796
+ def __init__(self):
797
+ self.unfold_batch = True
798
+
799
+ @classmethod
800
+ def INPUT_TYPES(s):
801
+ return {
802
+ "required": {
803
+ "model": ("MODEL", ),
804
+ "ipadapter": ("IPADAPTER", ),
805
+ "image": ("IMAGE",),
806
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
807
+ "weight_type": (WEIGHT_TYPES, ),
808
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
809
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
810
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
811
+ "encode_batch_size": ("INT", { "default": 0, "min": 0, "max": 4096 }),
812
+ },
813
+ "optional": {
814
+ "image_negative": ("IMAGE",),
815
+ "attn_mask": ("MASK",),
816
+ "clip_vision": ("CLIP_VISION",),
817
+ }
818
+ }
819
+
820
+ class IPAdapterStyleComposition(IPAdapterAdvanced):
821
+ @classmethod
822
+ def INPUT_TYPES(s):
823
+ return {
824
+ "required": {
825
+ "model": ("MODEL", ),
826
+ "ipadapter": ("IPADAPTER", ),
827
+ "image_style": ("IMAGE",),
828
+ "image_composition": ("IMAGE",),
829
+ "weight_style": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
830
+ "weight_composition": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
831
+ "expand_style": ("BOOLEAN", { "default": False }),
832
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"], {"default": "average"}),
833
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
834
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
835
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
836
+ },
837
+ "optional": {
838
+ "image_negative": ("IMAGE",),
839
+ "attn_mask": ("MASK",),
840
+ "clip_vision": ("CLIP_VISION",),
841
+ }
842
+ }
843
+
844
+ CATEGORY = "ipadapter/style_composition"
845
+
846
+ class IPAdapterStyleCompositionBatch(IPAdapterStyleComposition):
847
+ def __init__(self):
848
+ self.unfold_batch = True
849
+
850
+ @classmethod
851
+ def INPUT_TYPES(s):
852
+ return {
853
+ "required": {
854
+ "model": ("MODEL", ),
855
+ "ipadapter": ("IPADAPTER", ),
856
+ "image_style": ("IMAGE",),
857
+ "image_composition": ("IMAGE",),
858
+ "weight_style": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
859
+ "weight_composition": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
860
+ "expand_style": ("BOOLEAN", { "default": False }),
861
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
862
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
863
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
864
+ },
865
+ "optional": {
866
+ "image_negative": ("IMAGE",),
867
+ "attn_mask": ("MASK",),
868
+ "clip_vision": ("CLIP_VISION",),
869
+ }
870
+ }
871
+
872
+ class IPAdapterFaceID(IPAdapterAdvanced):
873
+ @classmethod
874
+ def INPUT_TYPES(s):
875
+ return {
876
+ "required": {
877
+ "model": ("MODEL", ),
878
+ "ipadapter": ("IPADAPTER", ),
879
+ "image": ("IMAGE",),
880
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 3, "step": 0.05 }),
881
+ "weight_faceidv2": ("FLOAT", { "default": 1.0, "min": -1, "max": 5.0, "step": 0.05 }),
882
+ "weight_type": (WEIGHT_TYPES, ),
883
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
884
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
885
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
886
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
887
+ },
888
+ "optional": {
889
+ "image_negative": ("IMAGE",),
890
+ "attn_mask": ("MASK",),
891
+ "clip_vision": ("CLIP_VISION",),
892
+ "insightface": ("INSIGHTFACE",),
893
+ }
894
+ }
895
+
896
+ CATEGORY = "ipadapter/faceid"
897
+ RETURN_TYPES = ("MODEL","IMAGE",)
898
+ RETURN_NAMES = ("MODEL", "face_image", )
899
+
900
+ class IPAAdapterFaceIDBatch(IPAdapterFaceID):
901
+ def __init__(self):
902
+ self.unfold_batch = True
903
+
904
+ class IPAdapterTiled:
905
+ def __init__(self):
906
+ self.unfold_batch = False
907
+
908
+ @classmethod
909
+ def INPUT_TYPES(s):
910
+ return {
911
+ "required": {
912
+ "model": ("MODEL", ),
913
+ "ipadapter": ("IPADAPTER", ),
914
+ "image": ("IMAGE",),
915
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 3, "step": 0.05 }),
916
+ "weight_type": (WEIGHT_TYPES, ),
917
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
918
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
919
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
920
+ "sharpening": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.05 }),
921
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
922
+ },
923
+ "optional": {
924
+ "image_negative": ("IMAGE",),
925
+ "attn_mask": ("MASK",),
926
+ "clip_vision": ("CLIP_VISION",),
927
+ }
928
+ }
929
+
930
+ RETURN_TYPES = ("MODEL", "IMAGE", "MASK", )
931
+ RETURN_NAMES = ("MODEL", "tiles", "masks", )
932
+ FUNCTION = "apply_tiled"
933
+ CATEGORY = "ipadapter/tiled"
934
+
935
+ def apply_tiled(self, model, ipadapter, image, weight, weight_type, start_at, end_at, sharpening, combine_embeds="concat", image_negative=None, attn_mask=None, clip_vision=None, embeds_scaling='V only', encode_batch_size=0):
936
+ # 1. Select the models
937
+ if 'ipadapter' in ipadapter:
938
+ ipadapter_model = ipadapter['ipadapter']['model']
939
+ clip_vision = clip_vision if clip_vision is not None else ipadapter['clipvision']['model']
940
+ else:
941
+ ipadapter_model = ipadapter
942
+ clip_vision = clip_vision
943
+
944
+ if clip_vision is None:
945
+ raise Exception("Missing CLIPVision model.")
946
+
947
+ del ipadapter
948
+
949
+ # 2. Extract the tiles
950
+ tile_size = 256 # I'm using 256 instead of 224 as it is more likely divisible by the latent size, it will be downscaled to 224 by the clip vision encoder
951
+ _, oh, ow, _ = image.shape
952
+ if attn_mask is None:
953
+ attn_mask = torch.ones([1, oh, ow], dtype=image.dtype, device=image.device)
954
+
955
+ image = image.permute([0,3,1,2])
956
+ attn_mask = attn_mask.unsqueeze(1)
957
+ # the mask should have the same proportions as the reference image and the latent
958
+ attn_mask = T.Resize((oh, ow), interpolation=T.InterpolationMode.BICUBIC, antialias=True)(attn_mask)
959
+
960
+ # if the image is almost a square, we crop it to a square
961
+ if oh / ow > 0.75 and oh / ow < 1.33:
962
+ # crop the image to a square
963
+ image = T.CenterCrop(min(oh, ow))(image)
964
+ resize = (tile_size*2, tile_size*2)
965
+
966
+ attn_mask = T.CenterCrop(min(oh, ow))(attn_mask)
967
+ # otherwise resize the smallest side and the other proportionally
968
+ else:
969
+ resize = (int(tile_size * ow / oh), tile_size) if oh < ow else (tile_size, int(tile_size * oh / ow))
970
+
971
+ # using PIL for better results
972
+ imgs = []
973
+ for img in image:
974
+ img = T.ToPILImage()(img)
975
+ img = img.resize(resize, resample=Image.Resampling['LANCZOS'])
976
+ imgs.append(T.ToTensor()(img))
977
+ image = torch.stack(imgs)
978
+ del imgs, img
979
+
980
+ # we don't need a high quality resize for the mask
981
+ attn_mask = T.Resize(resize[::-1], interpolation=T.InterpolationMode.BICUBIC, antialias=True)(attn_mask)
982
+
983
+ # we allow a maximum of 4 tiles
984
+ if oh / ow > 4 or oh / ow < 0.25:
985
+ crop = (tile_size, tile_size*4) if oh < ow else (tile_size*4, tile_size)
986
+ image = T.CenterCrop(crop)(image)
987
+ attn_mask = T.CenterCrop(crop)(attn_mask)
988
+
989
+ attn_mask = attn_mask.squeeze(1)
990
+
991
+ if sharpening > 0:
992
+ image = contrast_adaptive_sharpening(image, sharpening)
993
+
994
+ image = image.permute([0,2,3,1])
995
+
996
+ _, oh, ow, _ = image.shape
997
+
998
+ # find the number of tiles for each side
999
+ tiles_x = math.ceil(ow / tile_size)
1000
+ tiles_y = math.ceil(oh / tile_size)
1001
+ overlap_x = max(0, (tiles_x * tile_size - ow) / (tiles_x - 1 if tiles_x > 1 else 1))
1002
+ overlap_y = max(0, (tiles_y * tile_size - oh) / (tiles_y - 1 if tiles_y > 1 else 1))
1003
+
1004
+ base_mask = torch.zeros([attn_mask.shape[0], oh, ow], dtype=image.dtype, device=image.device)
1005
+
1006
+ # extract all the tiles from the image and create the masks
1007
+ tiles = []
1008
+ masks = []
1009
+ for y in range(tiles_y):
1010
+ for x in range(tiles_x):
1011
+ start_x = int(x * (tile_size - overlap_x))
1012
+ start_y = int(y * (tile_size - overlap_y))
1013
+ tiles.append(image[:, start_y:start_y+tile_size, start_x:start_x+tile_size, :])
1014
+ mask = base_mask.clone()
1015
+ mask[:, start_y:start_y+tile_size, start_x:start_x+tile_size] = attn_mask[:, start_y:start_y+tile_size, start_x:start_x+tile_size]
1016
+ masks.append(mask)
1017
+ del mask
1018
+
1019
+ # 3. Apply the ipadapter to each group of tiles
1020
+ model = model.clone()
1021
+ for i in range(len(tiles)):
1022
+ ipa_args = {
1023
+ "image": tiles[i],
1024
+ "image_negative": image_negative,
1025
+ "weight": weight,
1026
+ "weight_type": weight_type,
1027
+ "combine_embeds": combine_embeds,
1028
+ "start_at": start_at,
1029
+ "end_at": end_at,
1030
+ "attn_mask": masks[i],
1031
+ "unfold_batch": self.unfold_batch,
1032
+ "embeds_scaling": embeds_scaling,
1033
+ "encode_batch_size": encode_batch_size,
1034
+ }
1035
+ # apply the ipadapter to the model without cloning it
1036
+ model, _ = ipadapter_execute(model, ipadapter_model, clip_vision, **ipa_args)
1037
+
1038
+ return (model, torch.cat(tiles), torch.cat(masks), )
1039
+
1040
+ class IPAdapterTiledBatch(IPAdapterTiled):
1041
+ def __init__(self):
1042
+ self.unfold_batch = True
1043
+
1044
+ @classmethod
1045
+ def INPUT_TYPES(s):
1046
+ return {
1047
+ "required": {
1048
+ "model": ("MODEL", ),
1049
+ "ipadapter": ("IPADAPTER", ),
1050
+ "image": ("IMAGE",),
1051
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 3, "step": 0.05 }),
1052
+ "weight_type": (WEIGHT_TYPES, ),
1053
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1054
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1055
+ "sharpening": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.05 }),
1056
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1057
+ "encode_batch_size": ("INT", { "default": 0, "min": 0, "max": 4096 }),
1058
+ },
1059
+ "optional": {
1060
+ "image_negative": ("IMAGE",),
1061
+ "attn_mask": ("MASK",),
1062
+ "clip_vision": ("CLIP_VISION",),
1063
+ }
1064
+ }
1065
+
1066
+ class IPAdapterEmbeds:
1067
+ def __init__(self):
1068
+ self.unfold_batch = False
1069
+
1070
+ @classmethod
1071
+ def INPUT_TYPES(s):
1072
+ return {
1073
+ "required": {
1074
+ "model": ("MODEL", ),
1075
+ "ipadapter": ("IPADAPTER", ),
1076
+ "pos_embed": ("EMBEDS",),
1077
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 3, "step": 0.05 }),
1078
+ "weight_type": (WEIGHT_TYPES, ),
1079
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1080
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1081
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1082
+ },
1083
+ "optional": {
1084
+ "neg_embed": ("EMBEDS",),
1085
+ "attn_mask": ("MASK",),
1086
+ "clip_vision": ("CLIP_VISION",),
1087
+ }
1088
+ }
1089
+
1090
+ RETURN_TYPES = ("MODEL",)
1091
+ FUNCTION = "apply_ipadapter"
1092
+ CATEGORY = "ipadapter/embeds"
1093
+
1094
+ def apply_ipadapter(self, model, ipadapter, pos_embed, weight, weight_type, start_at, end_at, neg_embed=None, attn_mask=None, clip_vision=None, embeds_scaling='V only'):
1095
+ ipa_args = {
1096
+ "pos_embed": pos_embed,
1097
+ "neg_embed": neg_embed,
1098
+ "weight": weight,
1099
+ "weight_type": weight_type,
1100
+ "start_at": start_at,
1101
+ "end_at": end_at,
1102
+ "attn_mask": attn_mask,
1103
+ "embeds_scaling": embeds_scaling,
1104
+ "unfold_batch": self.unfold_batch,
1105
+ }
1106
+
1107
+ if 'ipadapter' in ipadapter:
1108
+ ipadapter_model = ipadapter['ipadapter']['model']
1109
+ clip_vision = clip_vision if clip_vision is not None else ipadapter['clipvision']['model']
1110
+ else:
1111
+ ipadapter_model = ipadapter
1112
+ clip_vision = clip_vision
1113
+
1114
+ if clip_vision is None and neg_embed is None:
1115
+ raise Exception("Missing CLIPVision model.")
1116
+
1117
+ del ipadapter
1118
+
1119
+ return ipadapter_execute(model.clone(), ipadapter_model, clip_vision, **ipa_args)
1120
+
1121
+ class IPAdapterEmbedsBatch(IPAdapterEmbeds):
1122
+ def __init__(self):
1123
+ self.unfold_batch = True
1124
+
1125
+ class IPAdapterMS(IPAdapterAdvanced):
1126
+ @classmethod
1127
+ def INPUT_TYPES(s):
1128
+ return {
1129
+ "required": {
1130
+ "model": ("MODEL", ),
1131
+ "ipadapter": ("IPADAPTER", ),
1132
+ "image": ("IMAGE",),
1133
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
1134
+ "weight_faceidv2": ("FLOAT", { "default": 1.0, "min": -1, "max": 5.0, "step": 0.05 }),
1135
+ "weight_type": (WEIGHT_TYPES, ),
1136
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
1137
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1138
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1139
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1140
+ "layer_weights": ("STRING", { "default": "", "multiline": True }),
1141
+ },
1142
+ "optional": {
1143
+ "image_negative": ("IMAGE",),
1144
+ "attn_mask": ("MASK",),
1145
+ "clip_vision": ("CLIP_VISION",),
1146
+ "insightface": ("INSIGHTFACE",),
1147
+ }
1148
+ }
1149
+
1150
+ CATEGORY = "ipadapter/dev"
1151
+
1152
+ class IPAdapterClipVisionEnhancer(IPAdapterAdvanced):
1153
+ @classmethod
1154
+ def INPUT_TYPES(s):
1155
+ return {
1156
+ "required": {
1157
+ "model": ("MODEL", ),
1158
+ "ipadapter": ("IPADAPTER", ),
1159
+ "image": ("IMAGE",),
1160
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
1161
+ "weight_type": (WEIGHT_TYPES, ),
1162
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
1163
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1164
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1165
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1166
+ "enhance_tiles": ("INT", { "default": 2, "min": 1, "max": 16 }),
1167
+ "enhance_ratio": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05 }),
1168
+ },
1169
+ "optional": {
1170
+ "image_negative": ("IMAGE",),
1171
+ "attn_mask": ("MASK",),
1172
+ "clip_vision": ("CLIP_VISION",),
1173
+ }
1174
+ }
1175
+
1176
+ CATEGORY = "ipadapter/dev"
1177
+
1178
+ class IPAdapterClipVisionEnhancerBatch(IPAdapterClipVisionEnhancer):
1179
+ def __init__(self):
1180
+ self.unfold_batch = True
1181
+
1182
+ @classmethod
1183
+ def INPUT_TYPES(s):
1184
+ return {
1185
+ "required": {
1186
+ "model": ("MODEL", ),
1187
+ "ipadapter": ("IPADAPTER", ),
1188
+ "image": ("IMAGE",),
1189
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
1190
+ "weight_type": (WEIGHT_TYPES, ),
1191
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1192
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1193
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1194
+ "enhance_tiles": ("INT", { "default": 2, "min": 1, "max": 16 }),
1195
+ "enhance_ratio": ("FLOAT", { "default": 0.5, "min": 0.0, "max": 1.0, "step": 0.05 }),
1196
+ "encode_batch_size": ("INT", { "default": 0, "min": 0, "max": 4096 }),
1197
+ },
1198
+ "optional": {
1199
+ "image_negative": ("IMAGE",),
1200
+ "attn_mask": ("MASK",),
1201
+ "clip_vision": ("CLIP_VISION",),
1202
+ }
1203
+ }
1204
+
1205
+ class IPAdapterFromParams(IPAdapterAdvanced):
1206
+ @classmethod
1207
+ def INPUT_TYPES(s):
1208
+ return {
1209
+ "required": {
1210
+ "model": ("MODEL", ),
1211
+ "ipadapter": ("IPADAPTER", ),
1212
+ "ipadapter_params": ("IPADAPTER_PARAMS", ),
1213
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
1214
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1215
+ },
1216
+ "optional": {
1217
+ "image_negative": ("IMAGE",),
1218
+ "clip_vision": ("CLIP_VISION",),
1219
+ }
1220
+ }
1221
+
1222
+ CATEGORY = "ipadapter/params"
1223
+
1224
+ class IPAdapterPreciseStyleTransfer(IPAdapterAdvanced):
1225
+ @classmethod
1226
+ def INPUT_TYPES(s):
1227
+ return {
1228
+ "required": {
1229
+ "model": ("MODEL", ),
1230
+ "ipadapter": ("IPADAPTER", ),
1231
+ "image": ("IMAGE",),
1232
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
1233
+ "style_boost": ("FLOAT", { "default": 1.0, "min": -5, "max": 5, "step": 0.05 }),
1234
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
1235
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1236
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1237
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1238
+ },
1239
+ "optional": {
1240
+ "image_negative": ("IMAGE",),
1241
+ "attn_mask": ("MASK",),
1242
+ "clip_vision": ("CLIP_VISION",),
1243
+ }
1244
+ }
1245
+
1246
+ class IPAdapterPreciseStyleTransferBatch(IPAdapterPreciseStyleTransfer):
1247
+ def __init__(self):
1248
+ self.unfold_batch = True
1249
+
1250
+ class IPAdapterPreciseComposition(IPAdapterAdvanced):
1251
+ @classmethod
1252
+ def INPUT_TYPES(s):
1253
+ return {
1254
+ "required": {
1255
+ "model": ("MODEL", ),
1256
+ "ipadapter": ("IPADAPTER", ),
1257
+ "image": ("IMAGE",),
1258
+ "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 5, "step": 0.05 }),
1259
+ "composition_boost": ("FLOAT", { "default": 0.0, "min": -5, "max": 5, "step": 0.05 }),
1260
+ "combine_embeds": (["concat", "add", "subtract", "average", "norm average"],),
1261
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1262
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1263
+ "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ),
1264
+ },
1265
+ "optional": {
1266
+ "image_negative": ("IMAGE",),
1267
+ "attn_mask": ("MASK",),
1268
+ "clip_vision": ("CLIP_VISION",),
1269
+ }
1270
+ }
1271
+
1272
+ class IPAdapterPreciseCompositionBatch(IPAdapterPreciseComposition):
1273
+ def __init__(self):
1274
+ self.unfold_batch = True
1275
+
1276
+ """
1277
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1278
+ Helpers
1279
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1280
+ """
1281
+ class IPAdapterEncoder:
1282
+ @classmethod
1283
+ def INPUT_TYPES(s):
1284
+ return {"required": {
1285
+ "ipadapter": ("IPADAPTER",),
1286
+ "image": ("IMAGE",),
1287
+ "weight": ("FLOAT", { "default": 1.0, "min": -1.0, "max": 3.0, "step": 0.01 }),
1288
+ },
1289
+ "optional": {
1290
+ "mask": ("MASK",),
1291
+ "clip_vision": ("CLIP_VISION",),
1292
+ }
1293
+ }
1294
+
1295
+ RETURN_TYPES = ("EMBEDS", "EMBEDS",)
1296
+ RETURN_NAMES = ("pos_embed", "neg_embed",)
1297
+ FUNCTION = "encode"
1298
+ CATEGORY = "ipadapter/embeds"
1299
+
1300
+ def encode(self, ipadapter, image, weight, mask=None, clip_vision=None):
1301
+ if 'ipadapter' in ipadapter:
1302
+ ipadapter_model = ipadapter['ipadapter']['model']
1303
+ clip_vision = clip_vision if clip_vision is not None else ipadapter['clipvision']['model']
1304
+ else:
1305
+ ipadapter_model = ipadapter
1306
+ clip_vision = clip_vision
1307
+
1308
+ if clip_vision is None:
1309
+ raise Exception("Missing CLIPVision model.")
1310
+
1311
+ is_plus = "proj.3.weight" in ipadapter_model["image_proj"] or "latents" in ipadapter_model["image_proj"] or "perceiver_resampler.proj_in.weight" in ipadapter_model["image_proj"]
1312
+ is_kwai_kolors = is_plus and "layers.0.0.to_out.weight" in ipadapter_model["image_proj"] and ipadapter_model["image_proj"]["layers.0.0.to_out.weight"].shape[0] == 2048
1313
+
1314
+ clipvision_size = 224 if not is_kwai_kolors else 336
1315
+
1316
+ # resize and crop the mask to 224x224
1317
+ if mask is not None and mask.shape[1:3] != torch.Size([clipvision_size, clipvision_size]):
1318
+ mask = mask.unsqueeze(1)
1319
+ transforms = T.Compose([
1320
+ T.CenterCrop(min(mask.shape[2], mask.shape[3])),
1321
+ T.Resize((clipvision_size, clipvision_size), interpolation=T.InterpolationMode.BICUBIC, antialias=True),
1322
+ ])
1323
+ mask = transforms(mask).squeeze(1)
1324
+ #mask = T.Resize((image.shape[1], image.shape[2]), interpolation=T.InterpolationMode.BICUBIC, antialias=True)(mask.unsqueeze(1)).squeeze(1)
1325
+
1326
+ img_cond_embeds = encode_image_masked(clip_vision, image, mask, clipvision_size=clipvision_size)
1327
+
1328
+ if is_plus:
1329
+ img_cond_embeds = img_cond_embeds.penultimate_hidden_states
1330
+ img_uncond_embeds = encode_image_masked(clip_vision, torch.zeros([1, clipvision_size, clipvision_size, 3]), clipvision_size=clipvision_size).penultimate_hidden_states
1331
+ else:
1332
+ img_cond_embeds = img_cond_embeds.image_embeds
1333
+ img_uncond_embeds = torch.zeros_like(img_cond_embeds)
1334
+
1335
+ if weight != 1:
1336
+ img_cond_embeds = img_cond_embeds * weight
1337
+
1338
+ return (img_cond_embeds, img_uncond_embeds, )
1339
+
1340
+ class IPAdapterCombineEmbeds:
1341
+ @classmethod
1342
+ def INPUT_TYPES(s):
1343
+ return {"required": {
1344
+ "embed1": ("EMBEDS",),
1345
+ "method": (["concat", "add", "subtract", "average", "norm average", "max", "min"], ),
1346
+ },
1347
+ "optional": {
1348
+ "embed2": ("EMBEDS",),
1349
+ "embed3": ("EMBEDS",),
1350
+ "embed4": ("EMBEDS",),
1351
+ "embed5": ("EMBEDS",),
1352
+ }}
1353
+
1354
+ RETURN_TYPES = ("EMBEDS",)
1355
+ FUNCTION = "batch"
1356
+ CATEGORY = "ipadapter/embeds"
1357
+
1358
+ def batch(self, embed1, method, embed2=None, embed3=None, embed4=None, embed5=None):
1359
+ if method=='concat' and embed2 is None and embed3 is None and embed4 is None and embed5 is None:
1360
+ return (embed1, )
1361
+
1362
+ embeds = [embed1, embed2, embed3, embed4, embed5]
1363
+ embeds = [embed for embed in embeds if embed is not None]
1364
+ embeds = torch.cat(embeds, dim=0)
1365
+
1366
+ if method == "add":
1367
+ embeds = torch.sum(embeds, dim=0).unsqueeze(0)
1368
+ elif method == "subtract":
1369
+ embeds = embeds[0] - torch.mean(embeds[1:], dim=0)
1370
+ embeds = embeds.unsqueeze(0)
1371
+ elif method == "average":
1372
+ embeds = torch.mean(embeds, dim=0).unsqueeze(0)
1373
+ elif method == "norm average":
1374
+ embeds = torch.mean(embeds / torch.norm(embeds, dim=0, keepdim=True), dim=0).unsqueeze(0)
1375
+ elif method == "max":
1376
+ embeds = torch.max(embeds, dim=0).values.unsqueeze(0)
1377
+ elif method == "min":
1378
+ embeds = torch.min(embeds, dim=0).values.unsqueeze(0)
1379
+
1380
+ return (embeds, )
1381
+
1382
+ class IPAdapterNoise:
1383
+ @classmethod
1384
+ def INPUT_TYPES(s):
1385
+ return {
1386
+ "required": {
1387
+ "type": (["fade", "dissolve", "gaussian", "shuffle"], ),
1388
+ "strength": ("FLOAT", { "default": 1.0, "min": 0, "max": 1, "step": 0.05 }),
1389
+ "blur": ("INT", { "default": 0, "min": 0, "max": 32, "step": 1 }),
1390
+ },
1391
+ "optional": {
1392
+ "image_optional": ("IMAGE",),
1393
+ }
1394
+ }
1395
+
1396
+ RETURN_TYPES = ("IMAGE",)
1397
+ FUNCTION = "make_noise"
1398
+ CATEGORY = "ipadapter/utils"
1399
+
1400
+ def make_noise(self, type, strength, blur, image_optional=None):
1401
+ if image_optional is None:
1402
+ image = torch.zeros([1, 224, 224, 3])
1403
+ else:
1404
+ transforms = T.Compose([
1405
+ T.CenterCrop(min(image_optional.shape[1], image_optional.shape[2])),
1406
+ T.Resize((224, 224), interpolation=T.InterpolationMode.BICUBIC, antialias=True),
1407
+ ])
1408
+ image = transforms(image_optional.permute([0,3,1,2])).permute([0,2,3,1])
1409
+
1410
+ seed = int(torch.sum(image).item()) % 1000000007 # hash the image to get a seed, grants predictability
1411
+ torch.manual_seed(seed)
1412
+
1413
+ if type == "fade":
1414
+ noise = torch.rand_like(image)
1415
+ noise = image * (1 - strength) + noise * strength
1416
+ elif type == "dissolve":
1417
+ mask = (torch.rand_like(image) < strength).float()
1418
+ noise = torch.rand_like(image)
1419
+ noise = image * (1-mask) + noise * mask
1420
+ elif type == "gaussian":
1421
+ noise = torch.randn_like(image) * strength
1422
+ noise = image + noise
1423
+ elif type == "shuffle":
1424
+ transforms = T.Compose([
1425
+ T.ElasticTransform(alpha=75.0, sigma=(1-strength)*3.5),
1426
+ T.RandomVerticalFlip(p=1.0),
1427
+ T.RandomHorizontalFlip(p=1.0),
1428
+ ])
1429
+ image = transforms(image.permute([0,3,1,2])).permute([0,2,3,1])
1430
+ noise = torch.randn_like(image) * (strength*0.75)
1431
+ noise = image * (1-noise) + noise
1432
+
1433
+ del image
1434
+ noise = torch.clamp(noise, 0, 1)
1435
+
1436
+ if blur > 0:
1437
+ if blur % 2 == 0:
1438
+ blur += 1
1439
+ noise = T.functional.gaussian_blur(noise.permute([0,3,1,2]), blur).permute([0,2,3,1])
1440
+
1441
+ return (noise, )
1442
+
1443
+ class PrepImageForClipVision:
1444
+ @classmethod
1445
+ def INPUT_TYPES(s):
1446
+ return {"required": {
1447
+ "image": ("IMAGE",),
1448
+ "interpolation": (["LANCZOS", "BICUBIC", "HAMMING", "BILINEAR", "BOX", "NEAREST"],),
1449
+ "crop_position": (["top", "bottom", "left", "right", "center", "pad"],),
1450
+ "sharpening": ("FLOAT", {"default": 0.0, "min": 0, "max": 1, "step": 0.05}),
1451
+ },
1452
+ }
1453
+
1454
+ RETURN_TYPES = ("IMAGE",)
1455
+ FUNCTION = "prep_image"
1456
+
1457
+ CATEGORY = "ipadapter/utils"
1458
+
1459
+ def prep_image(self, image, interpolation="LANCZOS", crop_position="center", sharpening=0.0):
1460
+ size = (224, 224)
1461
+ _, oh, ow, _ = image.shape
1462
+ output = image.permute([0,3,1,2])
1463
+
1464
+ if crop_position == "pad":
1465
+ if oh != ow:
1466
+ if oh > ow:
1467
+ pad = (oh - ow) // 2
1468
+ pad = (pad, 0, pad, 0)
1469
+ elif ow > oh:
1470
+ pad = (ow - oh) // 2
1471
+ pad = (0, pad, 0, pad)
1472
+ output = T.functional.pad(output, pad, fill=0)
1473
+ else:
1474
+ crop_size = min(oh, ow)
1475
+ x = (ow-crop_size) // 2
1476
+ y = (oh-crop_size) // 2
1477
+ if "top" in crop_position:
1478
+ y = 0
1479
+ elif "bottom" in crop_position:
1480
+ y = oh-crop_size
1481
+ elif "left" in crop_position:
1482
+ x = 0
1483
+ elif "right" in crop_position:
1484
+ x = ow-crop_size
1485
+
1486
+ x2 = x+crop_size
1487
+ y2 = y+crop_size
1488
+
1489
+ output = output[:, :, y:y2, x:x2]
1490
+
1491
+ imgs = []
1492
+ for img in output:
1493
+ img = T.ToPILImage()(img) # using PIL for better results
1494
+ img = img.resize(size, resample=Image.Resampling[interpolation])
1495
+ imgs.append(T.ToTensor()(img))
1496
+ output = torch.stack(imgs, dim=0)
1497
+ del imgs, img
1498
+
1499
+ if sharpening > 0:
1500
+ output = contrast_adaptive_sharpening(output, sharpening)
1501
+
1502
+ output = output.permute([0,2,3,1])
1503
+
1504
+ return (output, )
1505
+
1506
+ class IPAdapterSaveEmbeds:
1507
+ def __init__(self):
1508
+ self.output_dir = folder_paths.get_output_directory()
1509
+
1510
+ @classmethod
1511
+ def INPUT_TYPES(s):
1512
+ return {"required": {
1513
+ "embeds": ("EMBEDS",),
1514
+ "filename_prefix": ("STRING", {"default": "IP_embeds"})
1515
+ },
1516
+ }
1517
+
1518
+ RETURN_TYPES = ()
1519
+ FUNCTION = "save"
1520
+ OUTPUT_NODE = True
1521
+ CATEGORY = "ipadapter/embeds"
1522
+
1523
+ def save(self, embeds, filename_prefix):
1524
+ full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir)
1525
+ file = f"{filename}_{counter:05}.ipadpt"
1526
+ file = os.path.join(full_output_folder, file)
1527
+
1528
+ torch.save(embeds, file)
1529
+ return (None, )
1530
+
1531
+ class IPAdapterLoadEmbeds:
1532
+ @classmethod
1533
+ def INPUT_TYPES(s):
1534
+ input_dir = folder_paths.get_input_directory()
1535
+ files = [os.path.relpath(os.path.join(root, file), input_dir) for root, dirs, files in os.walk(input_dir) for file in files if file.endswith('.ipadpt')]
1536
+ return {"required": {"embeds": [sorted(files), ]}, }
1537
+
1538
+ RETURN_TYPES = ("EMBEDS", )
1539
+ FUNCTION = "load"
1540
+ CATEGORY = "ipadapter/embeds"
1541
+
1542
+ def load(self, embeds):
1543
+ path = folder_paths.get_annotated_filepath(embeds)
1544
+ return (torch.load(path).cpu(), )
1545
+
1546
+ class IPAdapterWeights:
1547
+ @classmethod
1548
+ def INPUT_TYPES(s):
1549
+ return {"required": {
1550
+ "weights": ("STRING", {"default": '1.0, 0.0', "multiline": True }),
1551
+ "timing": (["custom", "linear", "ease_in_out", "ease_in", "ease_out", "random"], { "default": "linear" } ),
1552
+ "frames": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1 }),
1553
+ "start_frame": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1 }),
1554
+ "end_frame": ("INT", {"default": 9999, "min": 0, "max": 9999, "step": 1 }),
1555
+ "add_starting_frames": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1 }),
1556
+ "add_ending_frames": ("INT", {"default": 0, "min": 0, "max": 9999, "step": 1 }),
1557
+ "method": (["full batch", "shift batches", "alternate batches"], { "default": "full batch" }),
1558
+ }, "optional": {
1559
+ "image": ("IMAGE",),
1560
+ }
1561
+ }
1562
+
1563
+ RETURN_TYPES = ("FLOAT", "FLOAT", "INT", "IMAGE", "IMAGE", "WEIGHTS_STRATEGY")
1564
+ RETURN_NAMES = ("weights", "weights_invert", "total_frames", "image_1", "image_2", "weights_strategy")
1565
+ FUNCTION = "weights"
1566
+ CATEGORY = "ipadapter/weights"
1567
+
1568
+ def weights(self, weights='', timing='custom', frames=0, start_frame=0, end_frame=9999, add_starting_frames=0, add_ending_frames=0, method='full batch', weights_strategy=None, image=None):
1569
+ import random
1570
+
1571
+ frame_count = image.shape[0] if image is not None else 0
1572
+ if weights_strategy is not None:
1573
+ weights = weights_strategy["weights"]
1574
+ timing = weights_strategy["timing"]
1575
+ frames = weights_strategy["frames"]
1576
+ start_frame = weights_strategy["start_frame"]
1577
+ end_frame = weights_strategy["end_frame"]
1578
+ add_starting_frames = weights_strategy["add_starting_frames"]
1579
+ add_ending_frames = weights_strategy["add_ending_frames"]
1580
+ method = weights_strategy["method"]
1581
+ frame_count = weights_strategy["frame_count"]
1582
+ else:
1583
+ weights_strategy = {
1584
+ "weights": weights,
1585
+ "timing": timing,
1586
+ "frames": frames,
1587
+ "start_frame": start_frame,
1588
+ "end_frame": end_frame,
1589
+ "add_starting_frames": add_starting_frames,
1590
+ "add_ending_frames": add_ending_frames,
1591
+ "method": method,
1592
+ "frame_count": frame_count,
1593
+ }
1594
+
1595
+ # convert the string to a list of floats separated by commas or newlines
1596
+ weights = weights.replace("\n", ",")
1597
+ weights = [float(weight) for weight in weights.split(",") if weight.strip() != ""]
1598
+
1599
+ if timing != "custom":
1600
+ frames = max(frames, 2)
1601
+ start = 0.0
1602
+ end = 1.0
1603
+
1604
+ if len(weights) > 0:
1605
+ start = weights[0]
1606
+ end = weights[-1]
1607
+
1608
+ weights = []
1609
+
1610
+ end_frame = min(end_frame, frames)
1611
+ duration = end_frame - start_frame
1612
+ if start_frame > 0:
1613
+ weights.extend([start] * start_frame)
1614
+
1615
+ for i in range(duration):
1616
+ n = duration - 1
1617
+ if timing == "linear":
1618
+ weights.append(start + (end - start) * i / n)
1619
+ elif timing == "ease_in_out":
1620
+ weights.append(start + (end - start) * (1 - math.cos(i / n * math.pi)) / 2)
1621
+ elif timing == "ease_in":
1622
+ weights.append(start + (end - start) * math.sin(i / n * math.pi / 2))
1623
+ elif timing == "ease_out":
1624
+ weights.append(start + (end - start) * (1 - math.cos(i / n * math.pi / 2)))
1625
+ elif timing == "random":
1626
+ weights.append(random.uniform(start, end))
1627
+
1628
+ weights[-1] = end if timing != "random" else weights[-1]
1629
+ if end_frame < frames:
1630
+ weights.extend([end] * (frames - end_frame))
1631
+
1632
+ if len(weights) == 0:
1633
+ weights = [0.0]
1634
+
1635
+ frames = len(weights)
1636
+
1637
+ # repeat the images for cross fade
1638
+ image_1 = None
1639
+ image_2 = None
1640
+
1641
+ # Calculate the min and max of the weights
1642
+ min_weight = min(weights)
1643
+ max_weight = max(weights)
1644
+
1645
+ if image is not None:
1646
+
1647
+ if "shift" in method:
1648
+ image_1 = image[:-1]
1649
+ image_2 = image[1:]
1650
+
1651
+ weights = weights * image_1.shape[0]
1652
+ image_1 = image_1.repeat_interleave(frames, 0)
1653
+ image_2 = image_2.repeat_interleave(frames, 0)
1654
+ elif "alternate" in method:
1655
+ image_1 = image[::2].repeat_interleave(2, 0)
1656
+ image_1 = image_1[1:]
1657
+ image_2 = image[1::2].repeat_interleave(2, 0)
1658
+
1659
+ # Invert the weights relative to their own range
1660
+ mew_weights = weights + [max_weight - (w - min_weight) for w in weights]
1661
+
1662
+ mew_weights = mew_weights * (image_1.shape[0] // 2)
1663
+ if image.shape[0] % 2:
1664
+ image_1 = image_1[:-1]
1665
+ else:
1666
+ image_2 = image_2[:-1]
1667
+ mew_weights = mew_weights + weights
1668
+
1669
+ weights = mew_weights
1670
+ image_1 = image_1.repeat_interleave(frames, 0)
1671
+ image_2 = image_2.repeat_interleave(frames, 0)
1672
+ else:
1673
+ weights = weights * image.shape[0]
1674
+ image_1 = image.repeat_interleave(frames, 0)
1675
+
1676
+ # add starting and ending frames
1677
+ if add_starting_frames > 0:
1678
+ weights = [weights[0]] * add_starting_frames + weights
1679
+ image_1 = torch.cat([image[:1].repeat(add_starting_frames, 1, 1, 1), image_1], dim=0)
1680
+ if image_2 is not None:
1681
+ image_2 = torch.cat([image[:1].repeat(add_starting_frames, 1, 1, 1), image_2], dim=0)
1682
+ if add_ending_frames > 0:
1683
+ weights = weights + [weights[-1]] * add_ending_frames
1684
+ image_1 = torch.cat([image_1, image[-1:].repeat(add_ending_frames, 1, 1, 1)], dim=0)
1685
+ if image_2 is not None:
1686
+ image_2 = torch.cat([image_2, image[-1:].repeat(add_ending_frames, 1, 1, 1)], dim=0)
1687
+
1688
+ # reverse the weights array
1689
+ weights_invert = weights[::-1]
1690
+
1691
+ frame_count = len(weights)
1692
+
1693
+ return (weights, weights_invert, frame_count, image_1, image_2, weights_strategy,)
1694
+
1695
+ class IPAdapterWeightsFromStrategy(IPAdapterWeights):
1696
+ @classmethod
1697
+ def INPUT_TYPES(s):
1698
+ return {"required": {
1699
+ "weights_strategy": ("WEIGHTS_STRATEGY",),
1700
+ }, "optional": {
1701
+ "image": ("IMAGE",),
1702
+ }
1703
+ }
1704
+
1705
+ class IPAdapterPromptScheduleFromWeightsStrategy():
1706
+ @classmethod
1707
+ def INPUT_TYPES(s):
1708
+ return {"required": {
1709
+ "weights_strategy": ("WEIGHTS_STRATEGY",),
1710
+ "prompt": ("STRING", {"default": "", "multiline": True }),
1711
+ }}
1712
+
1713
+ RETURN_TYPES = ("STRING",)
1714
+ RETURN_NAMES = ("prompt_schedule", )
1715
+ FUNCTION = "prompt_schedule"
1716
+ CATEGORY = "ipadapter/weights"
1717
+
1718
+ def prompt_schedule(self, weights_strategy, prompt=""):
1719
+ frames = weights_strategy["frames"]
1720
+ add_starting_frames = weights_strategy["add_starting_frames"]
1721
+ add_ending_frames = weights_strategy["add_ending_frames"]
1722
+ frame_count = weights_strategy["frame_count"]
1723
+
1724
+ out = ""
1725
+
1726
+ prompt = [p for p in prompt.split("\n") if p.strip() != ""]
1727
+
1728
+ if len(prompt) > 0 and frame_count > 0:
1729
+ # prompt_pos must be the same size as the image batch
1730
+ if len(prompt) > frame_count:
1731
+ prompt = prompt[:frame_count]
1732
+ elif len(prompt) < frame_count:
1733
+ prompt += [prompt[-1]] * (frame_count - len(prompt))
1734
+
1735
+ if add_starting_frames > 0:
1736
+ out += f"\"0\": \"{prompt[0]}\",\n"
1737
+ for i in range(frame_count):
1738
+ out += f"\"{i * frames + add_starting_frames}\": \"{prompt[i]}\",\n"
1739
+ if add_ending_frames > 0:
1740
+ out += f"\"{frame_count * frames + add_starting_frames}\": \"{prompt[-1]}\",\n"
1741
+
1742
+ return (out, )
1743
+
1744
+ class IPAdapterCombineWeights:
1745
+ @classmethod
1746
+ def INPUT_TYPES(s):
1747
+ return {
1748
+ "required": {
1749
+ "weights_1": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.05 }),
1750
+ "weights_2": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.05 }),
1751
+ }}
1752
+ RETURN_TYPES = ("FLOAT", "INT")
1753
+ RETURN_NAMES = ("weights", "count")
1754
+ FUNCTION = "combine"
1755
+ CATEGORY = "ipadapter/utils"
1756
+
1757
+ def combine(self, weights_1, weights_2):
1758
+ if not isinstance(weights_1, list):
1759
+ weights_1 = [weights_1]
1760
+ if not isinstance(weights_2, list):
1761
+ weights_2 = [weights_2]
1762
+ weights = weights_1 + weights_2
1763
+
1764
+ return (weights, len(weights), )
1765
+
1766
+ class IPAdapterRegionalConditioning:
1767
+ @classmethod
1768
+ def INPUT_TYPES(s):
1769
+ return {"required": {
1770
+ #"set_cond_area": (["default", "mask bounds"],),
1771
+ "image": ("IMAGE",),
1772
+ "image_weight": ("FLOAT", { "default": 1.0, "min": -1.0, "max": 3.0, "step": 0.05 }),
1773
+ "prompt_weight": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 10.0, "step": 0.05 }),
1774
+ "weight_type": (WEIGHT_TYPES, ),
1775
+ "start_at": ("FLOAT", { "default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1776
+ "end_at": ("FLOAT", { "default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001 }),
1777
+ }, "optional": {
1778
+ "mask": ("MASK",),
1779
+ "positive": ("CONDITIONING",),
1780
+ "negative": ("CONDITIONING",),
1781
+ }}
1782
+
1783
+ RETURN_TYPES = ("IPADAPTER_PARAMS", "CONDITIONING", "CONDITIONING", )
1784
+ RETURN_NAMES = ("IPADAPTER_PARAMS", "POSITIVE", "NEGATIVE")
1785
+ FUNCTION = "conditioning"
1786
+
1787
+ CATEGORY = "ipadapter/params"
1788
+
1789
+ def conditioning(self, image, image_weight, prompt_weight, weight_type, start_at, end_at, mask=None, positive=None, negative=None):
1790
+ set_area_to_bounds = False #if set_cond_area == "default" else True
1791
+
1792
+ if mask is not None:
1793
+ if positive is not None:
1794
+ positive = conditioning_set_values(positive, {"mask": mask, "set_area_to_bounds": set_area_to_bounds, "mask_strength": prompt_weight})
1795
+ if negative is not None:
1796
+ negative = conditioning_set_values(negative, {"mask": mask, "set_area_to_bounds": set_area_to_bounds, "mask_strength": prompt_weight})
1797
+
1798
+ ipadapter_params = {
1799
+ "image": [image],
1800
+ "attn_mask": [mask],
1801
+ "weight": [image_weight],
1802
+ "weight_type": [weight_type],
1803
+ "start_at": [start_at],
1804
+ "end_at": [end_at],
1805
+ }
1806
+
1807
+ return (ipadapter_params, positive, negative, )
1808
+
1809
+ class IPAdapterCombineParams:
1810
+ @classmethod
1811
+ def INPUT_TYPES(s):
1812
+ return {"required": {
1813
+ "params_1": ("IPADAPTER_PARAMS",),
1814
+ "params_2": ("IPADAPTER_PARAMS",),
1815
+ }, "optional": {
1816
+ "params_3": ("IPADAPTER_PARAMS",),
1817
+ "params_4": ("IPADAPTER_PARAMS",),
1818
+ "params_5": ("IPADAPTER_PARAMS",),
1819
+ }}
1820
+
1821
+ RETURN_TYPES = ("IPADAPTER_PARAMS",)
1822
+ FUNCTION = "combine"
1823
+ CATEGORY = "ipadapter/params"
1824
+
1825
+ def combine(self, params_1, params_2, params_3=None, params_4=None, params_5=None):
1826
+ ipadapter_params = {
1827
+ "image": params_1["image"] + params_2["image"],
1828
+ "attn_mask": params_1["attn_mask"] + params_2["attn_mask"],
1829
+ "weight": params_1["weight"] + params_2["weight"],
1830
+ "weight_type": params_1["weight_type"] + params_2["weight_type"],
1831
+ "start_at": params_1["start_at"] + params_2["start_at"],
1832
+ "end_at": params_1["end_at"] + params_2["end_at"],
1833
+ }
1834
+
1835
+ if params_3 is not None:
1836
+ ipadapter_params["image"] += params_3["image"]
1837
+ ipadapter_params["attn_mask"] += params_3["attn_mask"]
1838
+ ipadapter_params["weight"] += params_3["weight"]
1839
+ ipadapter_params["weight_type"] += params_3["weight_type"]
1840
+ ipadapter_params["start_at"] += params_3["start_at"]
1841
+ ipadapter_params["end_at"] += params_3["end_at"]
1842
+ if params_4 is not None:
1843
+ ipadapter_params["image"] += params_4["image"]
1844
+ ipadapter_params["attn_mask"] += params_4["attn_mask"]
1845
+ ipadapter_params["weight"] += params_4["weight"]
1846
+ ipadapter_params["weight_type"] += params_4["weight_type"]
1847
+ ipadapter_params["start_at"] += params_4["start_at"]
1848
+ ipadapter_params["end_at"] += params_4["end_at"]
1849
+ if params_5 is not None:
1850
+ ipadapter_params["image"] += params_5["image"]
1851
+ ipadapter_params["attn_mask"] += params_5["attn_mask"]
1852
+ ipadapter_params["weight"] += params_5["weight"]
1853
+ ipadapter_params["weight_type"] += params_5["weight_type"]
1854
+ ipadapter_params["start_at"] += params_5["start_at"]
1855
+ ipadapter_params["end_at"] += params_5["end_at"]
1856
+
1857
+ return (ipadapter_params, )
1858
+
1859
+ """
1860
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1861
+ Register
1862
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1863
+ """
1864
+ NODE_CLASS_MAPPINGS = {
1865
+ # Main Apply Nodes
1866
+ "IPAdapter": IPAdapterSimple,
1867
+ "IPAdapterAdvanced": IPAdapterAdvanced,
1868
+ "IPAdapterBatch": IPAdapterBatch,
1869
+ "IPAdapterFaceID": IPAdapterFaceID,
1870
+ "IPAAdapterFaceIDBatch": IPAAdapterFaceIDBatch,
1871
+ "IPAdapterTiled": IPAdapterTiled,
1872
+ "IPAdapterTiledBatch": IPAdapterTiledBatch,
1873
+ "IPAdapterEmbeds": IPAdapterEmbeds,
1874
+ "IPAdapterEmbedsBatch": IPAdapterEmbedsBatch,
1875
+ "IPAdapterStyleComposition": IPAdapterStyleComposition,
1876
+ "IPAdapterStyleCompositionBatch": IPAdapterStyleCompositionBatch,
1877
+ "IPAdapterMS": IPAdapterMS,
1878
+ "IPAdapterClipVisionEnhancer": IPAdapterClipVisionEnhancer,
1879
+ "IPAdapterClipVisionEnhancerBatch": IPAdapterClipVisionEnhancerBatch,
1880
+ "IPAdapterFromParams": IPAdapterFromParams,
1881
+ "IPAdapterPreciseStyleTransfer": IPAdapterPreciseStyleTransfer,
1882
+ "IPAdapterPreciseStyleTransferBatch": IPAdapterPreciseStyleTransferBatch,
1883
+ "IPAdapterPreciseComposition": IPAdapterPreciseComposition,
1884
+ "IPAdapterPreciseCompositionBatch": IPAdapterPreciseCompositionBatch,
1885
+
1886
+ # Loaders
1887
+ "IPAdapterUnifiedLoader": IPAdapterUnifiedLoader,
1888
+ "IPAdapterUnifiedLoaderFaceID": IPAdapterUnifiedLoaderFaceID,
1889
+ "IPAdapterModelLoader": IPAdapterModelLoader,
1890
+ "IPAdapterInsightFaceLoader": IPAdapterInsightFaceLoader,
1891
+ "IPAdapterUnifiedLoaderCommunity": IPAdapterUnifiedLoaderCommunity,
1892
+
1893
+ # Helpers
1894
+ "IPAdapterEncoder": IPAdapterEncoder,
1895
+ "IPAdapterCombineEmbeds": IPAdapterCombineEmbeds,
1896
+ "IPAdapterNoise": IPAdapterNoise,
1897
+ "PrepImageForClipVision": PrepImageForClipVision,
1898
+ "IPAdapterSaveEmbeds": IPAdapterSaveEmbeds,
1899
+ "IPAdapterLoadEmbeds": IPAdapterLoadEmbeds,
1900
+ "IPAdapterWeights": IPAdapterWeights,
1901
+ "IPAdapterCombineWeights": IPAdapterCombineWeights,
1902
+ "IPAdapterWeightsFromStrategy": IPAdapterWeightsFromStrategy,
1903
+ "IPAdapterPromptScheduleFromWeightsStrategy": IPAdapterPromptScheduleFromWeightsStrategy,
1904
+ "IPAdapterRegionalConditioning": IPAdapterRegionalConditioning,
1905
+ "IPAdapterCombineParams": IPAdapterCombineParams,
1906
+ }
1907
+
1908
+ NODE_DISPLAY_NAME_MAPPINGS = {
1909
+ # Main Apply Nodes
1910
+ "IPAdapter": "IPAdapter",
1911
+ "IPAdapterAdvanced": "IPAdapter Advanced",
1912
+ "IPAdapterBatch": "IPAdapter Batch (Adv.)",
1913
+ "IPAdapterFaceID": "IPAdapter FaceID",
1914
+ "IPAAdapterFaceIDBatch": "IPAdapter FaceID Batch",
1915
+ "IPAdapterTiled": "IPAdapter Tiled",
1916
+ "IPAdapterTiledBatch": "IPAdapter Tiled Batch",
1917
+ "IPAdapterEmbeds": "IPAdapter Embeds",
1918
+ "IPAdapterEmbedsBatch": "IPAdapter Embeds Batch",
1919
+ "IPAdapterStyleComposition": "IPAdapter Style & Composition SDXL",
1920
+ "IPAdapterStyleCompositionBatch": "IPAdapter Style & Composition Batch SDXL",
1921
+ "IPAdapterMS": "IPAdapter Mad Scientist",
1922
+ "IPAdapterClipVisionEnhancer": "IPAdapter ClipVision Enhancer",
1923
+ "IPAdapterClipVisionEnhancerBatch": "IPAdapter ClipVision Enhancer Batch",
1924
+ "IPAdapterFromParams": "IPAdapter from Params",
1925
+ "IPAdapterPreciseStyleTransfer": "IPAdapter Precise Style Transfer",
1926
+ "IPAdapterPreciseStyleTransferBatch": "IPAdapter Precise Style Transfer Batch",
1927
+ "IPAdapterPreciseComposition": "IPAdapter Precise Composition",
1928
+ "IPAdapterPreciseCompositionBatch": "IPAdapter Precise Composition Batch",
1929
+
1930
+ # Loaders
1931
+ "IPAdapterUnifiedLoader": "IPAdapter Unified Loader",
1932
+ "IPAdapterUnifiedLoaderFaceID": "IPAdapter Unified Loader FaceID",
1933
+ "IPAdapterModelLoader": "IPAdapter Model Loader",
1934
+ "IPAdapterInsightFaceLoader": "IPAdapter InsightFace Loader",
1935
+ "IPAdapterUnifiedLoaderCommunity": "IPAdapter Unified Loader Community",
1936
+
1937
+ # Helpers
1938
+ "IPAdapterEncoder": "IPAdapter Encoder",
1939
+ "IPAdapterCombineEmbeds": "IPAdapter Combine Embeds",
1940
+ "IPAdapterNoise": "IPAdapter Noise",
1941
+ "PrepImageForClipVision": "Prep Image For ClipVision",
1942
+ "IPAdapterSaveEmbeds": "IPAdapter Save Embeds",
1943
+ "IPAdapterLoadEmbeds": "IPAdapter Load Embeds",
1944
+ "IPAdapterWeights": "IPAdapter Weights",
1945
+ "IPAdapterWeightsFromStrategy": "IPAdapter Weights From Strategy",
1946
+ "IPAdapterPromptScheduleFromWeightsStrategy": "Prompt Schedule From Weights Strategy",
1947
+ "IPAdapterCombineWeights": "IPAdapter Combine Weights",
1948
+ "IPAdapterRegionalConditioning": "IPAdapter Regional Conditioning",
1949
+ "IPAdapterCombineParams": "IPAdapter Combine Params",
1950
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/NODES.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Nodes reference
2
+
3
+ Below I'm trying to document all the nodes. It's still very incomplete, be sure to check back later.
4
+
5
+ ## Loaders
6
+
7
+ ### :knot: IPAdapter Unified Loader
8
+
9
+ Loads the full stack of models needed for IPAdapter to function. The returned object will contain information regarding the **ipadapter** and **clip vision models**.
10
+
11
+ Multiple unified loaders should always be daisy chained through the `ipadapter` in/out. **Failing to do so will cause all models to be loaded twice.** For **the first** unified loader the `ipadapter` input **should never be connected**.
12
+
13
+ #### Inputs
14
+ - **model**, main ComfyUI model pipeline
15
+
16
+ #### Optional Inputs
17
+ - **ipadapter**, it's important to note that this is optional and used exclusively to daisy chain unified loaders. **The `ipadapter` input is never connected in the first `IPAdapter Unified Loader` of the chain.**
18
+
19
+ #### Outputs
20
+ - **model**, the model pipeline is used exclusively for configuration, the model comes out of this node untouched and it can be considered a reroute. Note that this is different from the Unified Loader FaceID that actually alters the model with a LoRA.
21
+ - **ipadapter**, connect this to any ipadater node. Each node will automatically detect if the `ipadapter` object contains the full stack of models or just one (like in the case [IPAdapter Model Loader](#ipadapter-model-loader)).
22
+
23
+ ### :knot: IPAdapter Model Loader
24
+
25
+ Loads the IPAdapter model only. The returned object will be the IPAdapter model contrary to the [Unified loader](#ipadapter-unified-loader) that contains the full stack of models.
26
+
27
+ #### Configuration parameters
28
+ - **ipadapter_file**, the main IPAdapter model. It must be located into `ComfyUI/models/ipadapter` or in any path specified in the `extra_model_paths.yaml` configuration file.
29
+
30
+ #### Outputs
31
+ - **IPADAPTER**, contains the loaded model only. Note that `IPADAPTER` will have a different structure when loaded by the [Unified Loader](#ipadapter-unified-loader).
32
+
33
+ ## Main IPAdapter Apply Nodes
34
+
35
+ ### :knot: IPAdapter Advanced
36
+
37
+ This node contains all the options to fine tune the IPAdapter models. It is a drop in replacement for the old `IPAdapter Apply` that is no longer available. If you have an old workflow, delete the existing `IPadapter Apply` node, add `IPAdapter Advanced` and connect all the pipes as before.
38
+
39
+ #### Inputs
40
+ - **model**, main model pipeline.
41
+ - **ipadapter**, the IPAdapter model. It can be connected to the [IPAdapter Model Loader](#ipadapter-model-loader) or any of the Unified Loaders. If a Unified loader is used anywhere in the workflow and you don't need a different model, it's always adviced to reuse the previous `ipadapter` pipeline.
42
+ - **image**, the reference image used to generate the positive conditioning. It should be a square image, other aspect ratios are automatically cropped in the center.
43
+
44
+ #### Optional inputs
45
+ - **image_negative**, image used to generate the negative conditioning. This is optional and normally handled by the code. It is possible to send noise or actually any image to instruct the model about what we don't want to see in the composition.
46
+ - **attn_mask**, a mask that will be applied during the image generation. **The mask should have the same size or at least the same aspect ratio of the latent**. The mask will define the area of influence of the IPAdapter models on the final image. Black zones won't be affected, white zones will get maximum influence. It can be a grayscale mask.
47
+ - **clip_vision**, this is optional if using any of the Unified loaders. If using the [IPAdapter Model Loader](#knot-ipadapter-model-loader) you also have to provide the clip vision model with a `Load CLIP Vision` node.
48
+
49
+ #### Configuration parameters
50
+ - **weight**, weight of the IPAdapter model. For `linear` `weight_type` (the default), a good starting point is 0.8. If you use other weight types you can experiment with higher values.
51
+ - **weight_type**, this is how the IPAdapter is applied to the UNet block. For example `ease-in` means that the input blocks have higher weight than the output ones. `week input` means that the whole input block has lower weight. `style transfer (SDXL)` only works with SDXL and it's a very powerful tool to tranfer only the style of an image but not its content. This parameter hugely impacts how the composition reacts to the text prompting.
52
+ - **combine_embeds**, when sending more than one reference image the embeddings can be sent one after the other (`concat`) or combined in various ways. For low spec GPUs it is adviced to `average` the embeds if you send multiple images. `subtract` subtracts the embeddings of the second image to the first; in case of 3 or more images they are averaged and subtracted to the first.
53
+ - **start_at/end_at**, this is the timestepping. Defines at what percentage point of the generation to start applying the IPAdapter model. The initial steps are the most important so if you start later (eg: `start_at=0.3`) the generated image will have a very light conditioning.
54
+ - **embeds_scaling**, the way the IPAdapter models are applied to the K,V. This parameter has a small impact on how the model reacts to text prompting. `K+mean(V) w/ C penalty` grants good quality at high weights (>1.0) without burning the image.
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/README.md ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ComfyUI IPAdapter plus
2
+ [ComfyUI](https://github.com/comfyanonymous/ComfyUI) reference implementation for [IPAdapter](https://github.com/tencent-ailab/IP-Adapter/) models.
3
+
4
+ The IPAdapter are very powerful models for image-to-image conditioning. The subject or even just the style of the reference image(s) can be easily transferred to a generation. Think of it as a 1-image lora.
5
+
6
+ # Sponsorship
7
+
8
+ <div align="center">
9
+
10
+ **[:heart: Github Sponsor](https://github.com/sponsors/cubiq) | [:coin: Paypal](https://paypal.me/matt3o)**
11
+
12
+ </div>
13
+
14
+ If you like my work and wish to see updates and new features please consider sponsoring my projects.
15
+
16
+ - [ComfyUI IPAdapter Plus](https://github.com/cubiq/ComfyUI_IPAdapter_plus)
17
+ - [ComfyUI InstantID (Native)](https://github.com/cubiq/ComfyUI_InstantID)
18
+ - [ComfyUI Essentials](https://github.com/cubiq/ComfyUI_essentials)
19
+ - [ComfyUI FaceAnalysis](https://github.com/cubiq/ComfyUI_FaceAnalysis)
20
+ - [Comfy Dungeon](https://github.com/cubiq/Comfy_Dungeon)
21
+
22
+ Not to mention the documentation and videos tutorials. Check my **ComfyUI Advanced Understanding** videos on YouTube for example, [part 1](https://www.youtube.com/watch?v=_C7kR2TFIX0) and [part 2](https://www.youtube.com/watch?v=ijqXnW_9gzc)
23
+
24
+ The only way to keep the code open and free is by sponsoring its development. The more sponsorships the more time I can dedicate to my open source projects.
25
+
26
+ Please consider a [Github Sponsorship](https://github.com/sponsors/cubiq) or [PayPal donation](https://paypal.me/matt3o) (Matteo "matt3o" Spinelli). For sponsorships of $50+, let me know if you'd like to be mentioned in this readme file, you can find me on [Discord](https://latent.vision/discord) or _matt3o :snail: gmail.com_.
27
+
28
+ ## Important updates
29
+
30
+ **2024/07/26**: Added support for image batches and animation to the ClipVision Enhancer.
31
+
32
+ **2024/07/18**: Support for Kolors.
33
+
34
+ **2024/07/17**: Added experimental ClipVision Enhancer node. It was somehow inspired by the [Scaling on Scales](https://arxiv.org/pdf/2403.13043) paper but the implementation is a bit different. The new IPAdapterClipVisionEnhancer tries to catch small details by tiling the embeds (instead of the image in the pixel space), the result is a slightly higher resolution visual embedding with no cost of performance.
35
+
36
+ **2024/07/11**: Added experimental Precise composition (layout) transfer. It's not as good as style. `embeds_scaling` has a huge impact. Start with strength 0.8 and boost 0.3 in SDXL and 0.6 boost 0.35 in SD1.5.
37
+
38
+ **2024/06/28**: Added the `IPAdapter Precise Style Transfer` node. Increase the `style_boost` option to lower the bleeding of the composition layer. **Important:** works better in SDXL, start with a style_boost of 2; for SD1.5 try to increase the weight a little over 1.0 and set the style_boost to a value between -1 and +1, starting with 0.
39
+
40
+ **2024/06/22**: Added `style transfer precise`, offers less bleeding of the embeds between the style and composition layers. It is sometimes better than the standard style transfer especially if the reference image is very different from the generated image. Works better in SDXL than SD1.5.
41
+
42
+ **2024/05/21**: Improved memory allocation when `encode_batch_size`. Useful mostly for very long animations.
43
+
44
+ **2024/05/02**: Add `encode_batch_size` to the Advanced batch node. This can be useful for animations with a lot of frames to reduce the VRAM usage during the image encoding. Please note that results will be slightly different based on the batch size.
45
+
46
+ **2024/04/27**: Refactored the IPAdapterWeights mostly useful for AnimateDiff animations.
47
+
48
+ **2024/04/21**: Added Regional Conditioning nodes to simplify attention masking and masked text conditioning.
49
+
50
+ **2024/04/16**: Added support for the new SDXL portrait unnorm model (link below). It's very strong and tends to ignore the text conditioning. Lower the CFG to 3-4 or use a RescaleCFG node.
51
+
52
+ **2024/04/12**: Added scheduled weights. Useful for animations.
53
+
54
+ *(Older updates removed for readability)*
55
+
56
+ ## Example workflows
57
+
58
+ The [examples directory](./examples/) has many workflows that cover all IPAdapter functionalities.
59
+
60
+ ![IPAdapter Example workflow](./examples/demo_workflow.jpg)
61
+
62
+ ## Video Tutorials
63
+
64
+ <a href="https://youtu.be/_JzDcgKgghY" target="_blank">
65
+ <img src="https://img.youtube.com/vi/_JzDcgKgghY/hqdefault.jpg" alt="Watch the video" />
66
+ </a>
67
+
68
+ - **:star: [New IPAdapter features](https://youtu.be/_JzDcgKgghY)**
69
+ - **:art: [IPAdapter Style and Composition](https://www.youtube.com/watch?v=czcgJnoDVd4)**
70
+
71
+ The following videos are about the previous version of IPAdapter, but they still contain valuable information.
72
+
73
+ :nerd_face: [Basic usage video](https://youtu.be/7m9ZZFU3HWo), :rocket: [Advanced features video](https://www.youtube.com/watch?v=mJQ62ly7jrg), :japanese_goblin: [Attention Masking video](https://www.youtube.com/watch?v=vqG1VXKteQg), :movie_camera: [Animation Features video](https://www.youtube.com/watch?v=ddYbhv3WgWw)
74
+
75
+ ## Installation
76
+
77
+ Download or git clone this repository inside `ComfyUI/custom_nodes/` directory or use the Manager. IPAdapter always requires the latest version of ComfyUI. If something doesn't work be sure to upgrade. Beware that the automatic update of the manager sometimes doesn't work and you may need to upgrade manually.
78
+
79
+ There's now a *Unified Model Loader*, for it to work you need to name the files exactly as described below. The legacy loaders work with any file name but you have to select them manually. The models can be placed into sub-directories.
80
+
81
+ Remember you can also use any custom location setting an `ipadapter` entry in the `extra_model_paths.yaml` file.
82
+
83
+ - `/ComfyUI/models/clip_vision`
84
+ - [CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors), download and rename
85
+ - [CLIP-ViT-bigG-14-laion2B-39B-b160k.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/image_encoder/model.safetensors), download and rename
86
+ - [clip-vit-large-patch14-336.bin](https://huggingface.co/Kwai-Kolors/Kolors-IP-Adapter-Plus/resolve/main/image_encoder/pytorch_model.bin), download and rename only for Kolors models
87
+ - `/ComfyUI/models/ipadapter`, create it if not present
88
+ - [ip-adapter_sd15.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15.safetensors), Basic model, average strength
89
+ - [ip-adapter_sd15_light_v11.bin](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15_light_v11.bin), Light impact model
90
+ - [ip-adapter-plus_sd15.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus_sd15.safetensors), Plus model, very strong
91
+ - [ip-adapter-plus-face_sd15.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus-face_sd15.safetensors), Face model, portraits
92
+ - [ip-adapter-full-face_sd15.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-full-face_sd15.safetensors), Stronger face model, not necessarily better
93
+ - [ip-adapter_sd15_vit-G.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15_vit-G.safetensors), Base model, **requires bigG clip vision encoder**
94
+ - [ip-adapter_sdxl_vit-h.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter_sdxl_vit-h.safetensors), SDXL model
95
+ - [ip-adapter-plus_sdxl_vit-h.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus_sdxl_vit-h.safetensors), SDXL plus model
96
+ - [ip-adapter-plus-face_sdxl_vit-h.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus-face_sdxl_vit-h.safetensors), SDXL face model
97
+ - [ip-adapter_sdxl.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter_sdxl.safetensors), vit-G SDXL model, **requires bigG clip vision encoder**
98
+ - **Deprecated** [ip-adapter_sd15_light.safetensors](https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15_light.safetensors), v1.0 Light impact model
99
+
100
+ **FaceID** models require `insightface`, you need to install it in your ComfyUI environment. Check [this issue](https://github.com/cubiq/ComfyUI_IPAdapter_plus/issues/162) for help. Remember that most FaceID models also need a LoRA.
101
+
102
+ For the Unified Loader to work the files need to be named exactly as shown in the list below.
103
+
104
+ - `/ComfyUI/models/ipadapter`
105
+ - [ip-adapter-faceid_sd15.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid_sd15.bin), base FaceID model
106
+ - [ip-adapter-faceid-plusv2_sd15.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15.bin), FaceID plus v2
107
+ - [ip-adapter-faceid-portrait-v11_sd15.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-portrait-v11_sd15.bin), text prompt style transfer for portraits
108
+ - [ip-adapter-faceid_sdxl.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid_sdxl.bin), SDXL base FaceID
109
+ - [ip-adapter-faceid-plusv2_sdxl.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sdxl.bin), SDXL plus v2
110
+ - [ip-adapter-faceid-portrait_sdxl.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-portrait_sdxl.bin), SDXL text prompt style transfer
111
+ - [ip-adapter-faceid-portrait_sdxl_unnorm.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-portrait_sdxl_unnorm.bin), very strong style transfer SDXL only
112
+ - **Deprecated** [ip-adapter-faceid-plus_sd15.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plus_sd15.bin), FaceID plus v1
113
+ - **Deprecated** [ip-adapter-faceid-portrait_sd15.bin](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-portrait_sd15.bin), v1 of the portrait model
114
+
115
+ Most FaceID models require a LoRA. If you use the `IPAdapter Unified Loader FaceID` it will be loaded automatically if you follow the naming convention. Otherwise you have to load them manually, be careful each FaceID model has to be paired with its own specific LoRA.
116
+
117
+ - `/ComfyUI/models/loras`
118
+ - [ip-adapter-faceid_sd15_lora.safetensors](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid_sd15_lora.safetensors)
119
+ - [ip-adapter-faceid-plusv2_sd15_lora.safetensors](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15_lora.safetensors)
120
+ - [ip-adapter-faceid_sdxl_lora.safetensors](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid_sdxl_lora.safetensors), SDXL FaceID LoRA
121
+ - [ip-adapter-faceid-plusv2_sdxl_lora.safetensors](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sdxl_lora.safetensors), SDXL plus v2 LoRA
122
+ - **Deprecated** [ip-adapter-faceid-plus_sd15_lora.safetensors](https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plus_sd15_lora.safetensors), LoRA for the deprecated FaceID plus v1 model
123
+
124
+ All models can be found on [huggingface](https://huggingface.co/h94).
125
+
126
+ ### Community's models
127
+
128
+ The community has baked some interesting IPAdapter models.
129
+
130
+ - `/ComfyUI/models/ipadapter`
131
+ - [ip_plus_composition_sd15.safetensors](https://huggingface.co/ostris/ip-composition-adapter/resolve/main/ip_plus_composition_sd15.safetensors), general composition ignoring style and content, more about it [here](https://huggingface.co/ostris/ip-composition-adapter)
132
+ - [ip_plus_composition_sdxl.safetensors](https://huggingface.co/ostris/ip-composition-adapter/resolve/main/ip_plus_composition_sdxl.safetensors), SDXL version
133
+ - [Kolors-IP-Adapter-Plus.bin](https://huggingface.co/Kwai-Kolors/Kolors-IP-Adapter-Plus/resolve/main/ip_adapter_plus_general.bin?download=true), IPAdapter Plus for Kolors model
134
+
135
+ if you know of other models please let me know and I will add them to the unified loader.
136
+
137
+ ## Generic suggestions
138
+
139
+ There are many workflows included in the [examples](./examples/) directory. Please check them before asking for support.
140
+
141
+ Usually it's a good idea to lower the `weight` to at least `0.8` and increase the number steps. To increase adherece to the prompt you may try to change the **weight type** in the `IPAdapter Advanced` node.
142
+
143
+ ## Nodes reference
144
+
145
+ I'm (slowly) documenting all nodes. Please check the [Nodes reference](./NODES.md).
146
+
147
+ ## Troubleshooting
148
+
149
+ Please check the [troubleshooting](https://github.com/cubiq/ComfyUI_IPAdapter_plus/issues/108) before posting a new issue. Also remember to check the previous closed issues.
150
+
151
+ ## Current sponsors
152
+
153
+ It's only thanks to generous sponsors that **the whole community** can enjoy open and free software. Please join me in thanking the following companies and individuals!
154
+
155
+ ### :trophy: Gold sponsors
156
+
157
+ [![Kaiber.ai](https://f.latent.vision/imgs/kaiber.png)](https://kaiber.ai/)&nbsp; &nbsp;[![Kaiber.ai](https://f.latent.vision/imgs/replicate.png)](https://replicate.com/)
158
+
159
+ ### :tada: Silver sponsors
160
+
161
+ [![OperArt.ai](https://f.latent.vision/imgs/openart.png?r=1)](https://openart.ai/workflows)&nbsp; &nbsp;[![OperArt.ai](https://f.latent.vision/imgs/finetuners.png)](https://www.finetuners.ai/)&nbsp; &nbsp;[![Comfy.ICU](https://f.latent.vision/imgs/comfyicu.png?r=1)](https://comfy.icu/)
162
+
163
+ ### Companies supporting my projects
164
+
165
+ - [RunComfy](https://www.runcomfy.com/) (ComfyUI Cloud)
166
+
167
+ ### Esteemed individuals
168
+
169
+ - [Jack Gane](https://github.com/ganeJackS)
170
+ - [Nathan Shipley](https://www.nathanshipley.com/)
171
+ - [Dkdnzia](https://github.com/Dkdnzia)
172
+
173
+ ### One-time Extraordinaires
174
+
175
+ - [Eric Rollei](https://github.com/EricRollei)
176
+ - [francaleu](https://github.com/francaleu)
177
+ - [Neta.art](https://github.com/talesofai)
178
+ - [Samwise Wang](https://github.com/tzwm)
179
+ - _And all private sponsors, you know who you are!_
180
+
181
+ ## Credits
182
+
183
+ - [IPAdapter](https://github.com/tencent-ailab/IP-Adapter/)
184
+ - [InstantStyle](https://github.com/InstantStyle/InstantStyle)
185
+ - [B-Lora](https://github.com/yardenfren1996/B-LoRA/)
186
+ - [ComfyUI](https://github.com/comfyanonymous/ComfyUI)
187
+ - [laksjdjf](https://github.com/laksjdjf/)
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ██▓ ██▓███ ▄▄▄ ▓█████▄ ▄▄▄ ██▓███ ▄▄▄█████▓▓█████ ██▀███
3
+ ▓██▒▓██░ ██▒▒████▄ ▒██▀ ██▌▒████▄ ▓██░ ██▒▓ ██▒ ▓▒▓█ ▀ ▓██ ▒ ██▒
4
+ ▒██▒▓██░ ██▓▒▒██ ▀█▄ ░██ █▌▒██ ▀█▄ ▓██░ ██▓▒▒ ▓██░ ▒░▒███ ▓██ ░▄█ ▒
5
+ ░██░▒██▄█▓▒ ▒░██▄▄▄▄██ ░▓█▄ ▌░██▄▄▄▄██ ▒██▄█▓▒ ▒░ ▓██▓ ░ ▒▓█ ▄ ▒██▀▀█▄
6
+ ░██░▒██▒ ░ ░ ▓█ ▓██▒░▒████▓ ▓█ ▓██▒▒██▒ ░ ░ ▒██▒ ░ ░▒████▒░██▓ ▒██▒
7
+ ░▓ ▒▓▒░ ░ ░ ▒▒ ▓▒█░ ▒▒▓ ▒ ▒▒ ▓▒█░▒▓▒░ ░ ░ ▒ ░░ ░░ ▒░ ░░ ▒▓ ░▒▓░
8
+ ▒ ░░▒ ░ ▒ ▒▒ ░ ░ ▒ ▒ ▒ ▒▒ ░░▒ ░ ░ ░ ░ ░ ░▒ ░ ▒░
9
+ ▒ ░░░ ░ ▒ ░ ░ ░ ░ ▒ ░░ ░ ░ ░░ ░
10
+ ░ ░ ░ ░ ░ ░ ░ ░ ░
11
+
12
+ · -—+ IPAdapter Plus Extension for ComfyUI +—- ·
13
+ Brought to you by Matteo "Matt3o/Cubiq" Spinelli
14
+ https://github.com/cubiq/ComfyUI_IPAdapter_plus/
15
+ """
16
+
17
+ from .IPAdapterPlus import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
18
+
19
+ __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/demo_workflow.jpg ADDED
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_advanced.json ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 17,
3
+ "last_link_id": 26,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ 50,
10
+ 730
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 20
25
+ ],
26
+ "slot_index": 0
27
+ },
28
+ {
29
+ "name": "CLIP",
30
+ "type": "CLIP",
31
+ "links": [
32
+ 3,
33
+ 5
34
+ ],
35
+ "slot_index": 1
36
+ },
37
+ {
38
+ "name": "VAE",
39
+ "type": "VAE",
40
+ "links": [
41
+ 8
42
+ ],
43
+ "slot_index": 2
44
+ }
45
+ ],
46
+ "properties": {
47
+ "Node name for S&R": "CheckpointLoaderSimple"
48
+ },
49
+ "widgets_values": [
50
+ "sd15/realisticVisionV51_v51VAE.safetensors"
51
+ ]
52
+ },
53
+ {
54
+ "id": 9,
55
+ "type": "SaveImage",
56
+ "pos": [
57
+ 1770,
58
+ 710
59
+ ],
60
+ "size": {
61
+ "0": 529.7760009765625,
62
+ "1": 582.3048095703125
63
+ },
64
+ "flags": {},
65
+ "order": 11,
66
+ "mode": 0,
67
+ "inputs": [
68
+ {
69
+ "name": "images",
70
+ "type": "IMAGE",
71
+ "link": 9
72
+ }
73
+ ],
74
+ "properties": {},
75
+ "widgets_values": [
76
+ "IPAdapter"
77
+ ]
78
+ },
79
+ {
80
+ "id": 7,
81
+ "type": "CLIPTextEncode",
82
+ "pos": [
83
+ 690,
84
+ 840
85
+ ],
86
+ "size": {
87
+ "0": 425.27801513671875,
88
+ "1": 180.6060791015625
89
+ },
90
+ "flags": {},
91
+ "order": 6,
92
+ "mode": 0,
93
+ "inputs": [
94
+ {
95
+ "name": "clip",
96
+ "type": "CLIP",
97
+ "link": 5
98
+ }
99
+ ],
100
+ "outputs": [
101
+ {
102
+ "name": "CONDITIONING",
103
+ "type": "CONDITIONING",
104
+ "links": [
105
+ 6
106
+ ],
107
+ "slot_index": 0
108
+ }
109
+ ],
110
+ "properties": {
111
+ "Node name for S&R": "CLIPTextEncode"
112
+ },
113
+ "widgets_values": [
114
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
115
+ ]
116
+ },
117
+ {
118
+ "id": 8,
119
+ "type": "VAEDecode",
120
+ "pos": [
121
+ 1570,
122
+ 700
123
+ ],
124
+ "size": {
125
+ "0": 140,
126
+ "1": 46
127
+ },
128
+ "flags": {},
129
+ "order": 10,
130
+ "mode": 0,
131
+ "inputs": [
132
+ {
133
+ "name": "samples",
134
+ "type": "LATENT",
135
+ "link": 7
136
+ },
137
+ {
138
+ "name": "vae",
139
+ "type": "VAE",
140
+ "link": 8
141
+ }
142
+ ],
143
+ "outputs": [
144
+ {
145
+ "name": "IMAGE",
146
+ "type": "IMAGE",
147
+ "links": [
148
+ 9
149
+ ],
150
+ "slot_index": 0
151
+ }
152
+ ],
153
+ "properties": {
154
+ "Node name for S&R": "VAEDecode"
155
+ }
156
+ },
157
+ {
158
+ "id": 5,
159
+ "type": "EmptyLatentImage",
160
+ "pos": [
161
+ 801,
162
+ 1097
163
+ ],
164
+ "size": {
165
+ "0": 315,
166
+ "1": 106
167
+ },
168
+ "flags": {},
169
+ "order": 1,
170
+ "mode": 0,
171
+ "outputs": [
172
+ {
173
+ "name": "LATENT",
174
+ "type": "LATENT",
175
+ "links": [
176
+ 2
177
+ ],
178
+ "slot_index": 0
179
+ }
180
+ ],
181
+ "properties": {
182
+ "Node name for S&R": "EmptyLatentImage"
183
+ },
184
+ "widgets_values": [
185
+ 512,
186
+ 512,
187
+ 1
188
+ ]
189
+ },
190
+ {
191
+ "id": 6,
192
+ "type": "CLIPTextEncode",
193
+ "pos": [
194
+ 690,
195
+ 610
196
+ ],
197
+ "size": {
198
+ "0": 422.84503173828125,
199
+ "1": 164.31304931640625
200
+ },
201
+ "flags": {},
202
+ "order": 5,
203
+ "mode": 0,
204
+ "inputs": [
205
+ {
206
+ "name": "clip",
207
+ "type": "CLIP",
208
+ "link": 3
209
+ }
210
+ ],
211
+ "outputs": [
212
+ {
213
+ "name": "CONDITIONING",
214
+ "type": "CONDITIONING",
215
+ "links": [
216
+ 4
217
+ ],
218
+ "slot_index": 0
219
+ }
220
+ ],
221
+ "properties": {
222
+ "Node name for S&R": "CLIPTextEncode"
223
+ },
224
+ "widgets_values": [
225
+ "in a peaceful spring morning a woman wearing a white shirt is sitting in a park on a bench\n\nhigh quality, detailed, diffuse light"
226
+ ]
227
+ },
228
+ {
229
+ "id": 3,
230
+ "type": "KSampler",
231
+ "pos": [
232
+ 1210,
233
+ 700
234
+ ],
235
+ "size": {
236
+ "0": 315,
237
+ "1": 262
238
+ },
239
+ "flags": {},
240
+ "order": 9,
241
+ "mode": 0,
242
+ "inputs": [
243
+ {
244
+ "name": "model",
245
+ "type": "MODEL",
246
+ "link": 23
247
+ },
248
+ {
249
+ "name": "positive",
250
+ "type": "CONDITIONING",
251
+ "link": 4
252
+ },
253
+ {
254
+ "name": "negative",
255
+ "type": "CONDITIONING",
256
+ "link": 6
257
+ },
258
+ {
259
+ "name": "latent_image",
260
+ "type": "LATENT",
261
+ "link": 2
262
+ }
263
+ ],
264
+ "outputs": [
265
+ {
266
+ "name": "LATENT",
267
+ "type": "LATENT",
268
+ "links": [
269
+ 7
270
+ ],
271
+ "slot_index": 0
272
+ }
273
+ ],
274
+ "properties": {
275
+ "Node name for S&R": "KSampler"
276
+ },
277
+ "widgets_values": [
278
+ 0,
279
+ "fixed",
280
+ 30,
281
+ 6.5,
282
+ "ddpm",
283
+ "karras",
284
+ 1
285
+ ]
286
+ },
287
+ {
288
+ "id": 14,
289
+ "type": "IPAdapterAdvanced",
290
+ "pos": [
291
+ 801,
292
+ 256
293
+ ],
294
+ "size": {
295
+ "0": 315,
296
+ "1": 278
297
+ },
298
+ "flags": {},
299
+ "order": 8,
300
+ "mode": 0,
301
+ "inputs": [
302
+ {
303
+ "name": "model",
304
+ "type": "MODEL",
305
+ "link": 20
306
+ },
307
+ {
308
+ "name": "ipadapter",
309
+ "type": "IPADAPTER",
310
+ "link": 21,
311
+ "slot_index": 1
312
+ },
313
+ {
314
+ "name": "image",
315
+ "type": "IMAGE",
316
+ "link": 26
317
+ },
318
+ {
319
+ "name": "image_negative",
320
+ "type": "IMAGE",
321
+ "link": null
322
+ },
323
+ {
324
+ "name": "attn_mask",
325
+ "type": "MASK",
326
+ "link": null
327
+ },
328
+ {
329
+ "name": "clip_vision",
330
+ "type": "CLIP_VISION",
331
+ "link": 24,
332
+ "slot_index": 5
333
+ }
334
+ ],
335
+ "outputs": [
336
+ {
337
+ "name": "MODEL",
338
+ "type": "MODEL",
339
+ "links": [
340
+ 23
341
+ ],
342
+ "shape": 3,
343
+ "slot_index": 0
344
+ }
345
+ ],
346
+ "properties": {
347
+ "Node name for S&R": "IPAdapterAdvanced"
348
+ },
349
+ "widgets_values": [
350
+ 0.8,
351
+ "linear",
352
+ "concat",
353
+ 0,
354
+ 1,
355
+ "V only"
356
+ ]
357
+ },
358
+ {
359
+ "id": 17,
360
+ "type": "PrepImageForClipVision",
361
+ "pos": [
362
+ 797,
363
+ 87
364
+ ],
365
+ "size": {
366
+ "0": 315,
367
+ "1": 106
368
+ },
369
+ "flags": {},
370
+ "order": 7,
371
+ "mode": 0,
372
+ "inputs": [
373
+ {
374
+ "name": "image",
375
+ "type": "IMAGE",
376
+ "link": 25
377
+ }
378
+ ],
379
+ "outputs": [
380
+ {
381
+ "name": "IMAGE",
382
+ "type": "IMAGE",
383
+ "links": [
384
+ 26
385
+ ],
386
+ "shape": 3,
387
+ "slot_index": 0
388
+ }
389
+ ],
390
+ "properties": {
391
+ "Node name for S&R": "PrepImageForClipVision"
392
+ },
393
+ "widgets_values": [
394
+ "LANCZOS",
395
+ "top",
396
+ 0.15
397
+ ]
398
+ },
399
+ {
400
+ "id": 15,
401
+ "type": "IPAdapterModelLoader",
402
+ "pos": [
403
+ 308,
404
+ 52
405
+ ],
406
+ "size": {
407
+ "0": 315,
408
+ "1": 58
409
+ },
410
+ "flags": {},
411
+ "order": 2,
412
+ "mode": 0,
413
+ "outputs": [
414
+ {
415
+ "name": "IPADAPTER",
416
+ "type": "IPADAPTER",
417
+ "links": [
418
+ 21
419
+ ],
420
+ "shape": 3
421
+ }
422
+ ],
423
+ "properties": {
424
+ "Node name for S&R": "IPAdapterModelLoader"
425
+ },
426
+ "widgets_values": [
427
+ "ip-adapter-plus_sd15.safetensors"
428
+ ]
429
+ },
430
+ {
431
+ "id": 16,
432
+ "type": "CLIPVisionLoader",
433
+ "pos": [
434
+ 308,
435
+ 161
436
+ ],
437
+ "size": {
438
+ "0": 315,
439
+ "1": 58
440
+ },
441
+ "flags": {},
442
+ "order": 3,
443
+ "mode": 0,
444
+ "outputs": [
445
+ {
446
+ "name": "CLIP_VISION",
447
+ "type": "CLIP_VISION",
448
+ "links": [
449
+ 24
450
+ ],
451
+ "shape": 3
452
+ }
453
+ ],
454
+ "properties": {
455
+ "Node name for S&R": "CLIPVisionLoader"
456
+ },
457
+ "widgets_values": [
458
+ "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors"
459
+ ]
460
+ },
461
+ {
462
+ "id": 12,
463
+ "type": "LoadImage",
464
+ "pos": [
465
+ 311,
466
+ 270
467
+ ],
468
+ "size": {
469
+ "0": 315,
470
+ "1": 314
471
+ },
472
+ "flags": {},
473
+ "order": 4,
474
+ "mode": 0,
475
+ "outputs": [
476
+ {
477
+ "name": "IMAGE",
478
+ "type": "IMAGE",
479
+ "links": [
480
+ 25
481
+ ],
482
+ "shape": 3,
483
+ "slot_index": 0
484
+ },
485
+ {
486
+ "name": "MASK",
487
+ "type": "MASK",
488
+ "links": null,
489
+ "shape": 3
490
+ }
491
+ ],
492
+ "properties": {
493
+ "Node name for S&R": "LoadImage"
494
+ },
495
+ "widgets_values": [
496
+ "warrior_woman.png",
497
+ "image"
498
+ ]
499
+ }
500
+ ],
501
+ "links": [
502
+ [
503
+ 2,
504
+ 5,
505
+ 0,
506
+ 3,
507
+ 3,
508
+ "LATENT"
509
+ ],
510
+ [
511
+ 3,
512
+ 4,
513
+ 1,
514
+ 6,
515
+ 0,
516
+ "CLIP"
517
+ ],
518
+ [
519
+ 4,
520
+ 6,
521
+ 0,
522
+ 3,
523
+ 1,
524
+ "CONDITIONING"
525
+ ],
526
+ [
527
+ 5,
528
+ 4,
529
+ 1,
530
+ 7,
531
+ 0,
532
+ "CLIP"
533
+ ],
534
+ [
535
+ 6,
536
+ 7,
537
+ 0,
538
+ 3,
539
+ 2,
540
+ "CONDITIONING"
541
+ ],
542
+ [
543
+ 7,
544
+ 3,
545
+ 0,
546
+ 8,
547
+ 0,
548
+ "LATENT"
549
+ ],
550
+ [
551
+ 8,
552
+ 4,
553
+ 2,
554
+ 8,
555
+ 1,
556
+ "VAE"
557
+ ],
558
+ [
559
+ 9,
560
+ 8,
561
+ 0,
562
+ 9,
563
+ 0,
564
+ "IMAGE"
565
+ ],
566
+ [
567
+ 20,
568
+ 4,
569
+ 0,
570
+ 14,
571
+ 0,
572
+ "MODEL"
573
+ ],
574
+ [
575
+ 21,
576
+ 15,
577
+ 0,
578
+ 14,
579
+ 1,
580
+ "IPADAPTER"
581
+ ],
582
+ [
583
+ 23,
584
+ 14,
585
+ 0,
586
+ 3,
587
+ 0,
588
+ "MODEL"
589
+ ],
590
+ [
591
+ 24,
592
+ 16,
593
+ 0,
594
+ 14,
595
+ 5,
596
+ "CLIP_VISION"
597
+ ],
598
+ [
599
+ 25,
600
+ 12,
601
+ 0,
602
+ 17,
603
+ 0,
604
+ "IMAGE"
605
+ ],
606
+ [
607
+ 26,
608
+ 17,
609
+ 0,
610
+ 14,
611
+ 2,
612
+ "IMAGE"
613
+ ]
614
+ ],
615
+ "groups": [],
616
+ "config": {},
617
+ "extra": {},
618
+ "version": 0.4
619
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_clipvision_enhancer.json ADDED
@@ -0,0 +1,918 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 42,
3
+ "last_link_id": 81,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ -816,
10
+ -107
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 16
25
+ ],
26
+ "slot_index": 0
27
+ },
28
+ {
29
+ "name": "CLIP",
30
+ "type": "CLIP",
31
+ "links": [
32
+ 3,
33
+ 5
34
+ ],
35
+ "slot_index": 1
36
+ },
37
+ {
38
+ "name": "VAE",
39
+ "type": "VAE",
40
+ "links": [
41
+ 59
42
+ ],
43
+ "slot_index": 2
44
+ }
45
+ ],
46
+ "properties": {
47
+ "Node name for S&R": "CheckpointLoaderSimple"
48
+ },
49
+ "widgets_values": [
50
+ "sdxl/RealVisXL_V4.0.safetensors"
51
+ ]
52
+ },
53
+ {
54
+ "id": 36,
55
+ "type": "ImageCASharpening+",
56
+ "pos": [
57
+ -160,
58
+ -580
59
+ ],
60
+ "size": [
61
+ 310.79998779296875,
62
+ 58
63
+ ],
64
+ "flags": {},
65
+ "order": 13,
66
+ "mode": 0,
67
+ "inputs": [
68
+ {
69
+ "name": "image",
70
+ "type": "IMAGE",
71
+ "link": 67
72
+ }
73
+ ],
74
+ "outputs": [
75
+ {
76
+ "name": "IMAGE",
77
+ "type": "IMAGE",
78
+ "links": [
79
+ 68
80
+ ],
81
+ "shape": 3,
82
+ "slot_index": 0
83
+ }
84
+ ],
85
+ "properties": {
86
+ "Node name for S&R": "ImageCASharpening+"
87
+ },
88
+ "widgets_values": [
89
+ 0.5
90
+ ]
91
+ },
92
+ {
93
+ "id": 29,
94
+ "type": "ImageScale",
95
+ "pos": [
96
+ -270,
97
+ -440
98
+ ],
99
+ "size": [
100
+ 231.94505310058594,
101
+ 130
102
+ ],
103
+ "flags": {},
104
+ "order": 12,
105
+ "mode": 0,
106
+ "inputs": [
107
+ {
108
+ "name": "image",
109
+ "type": "IMAGE",
110
+ "link": 79
111
+ },
112
+ {
113
+ "name": "width",
114
+ "type": "INT",
115
+ "link": 51,
116
+ "widget": {
117
+ "name": "width"
118
+ }
119
+ },
120
+ {
121
+ "name": "height",
122
+ "type": "INT",
123
+ "link": 53,
124
+ "widget": {
125
+ "name": "height"
126
+ }
127
+ }
128
+ ],
129
+ "outputs": [
130
+ {
131
+ "name": "IMAGE",
132
+ "type": "IMAGE",
133
+ "links": [
134
+ 67
135
+ ],
136
+ "shape": 3,
137
+ "slot_index": 0
138
+ }
139
+ ],
140
+ "properties": {
141
+ "Node name for S&R": "ImageScale"
142
+ },
143
+ "widgets_values": [
144
+ "lanczos",
145
+ 224,
146
+ 224,
147
+ "disabled"
148
+ ]
149
+ },
150
+ {
151
+ "id": 13,
152
+ "type": "IPAdapterUnifiedLoader",
153
+ "pos": [
154
+ -296,
155
+ -232
156
+ ],
157
+ "size": {
158
+ "0": 315,
159
+ "1": 78
160
+ },
161
+ "flags": {},
162
+ "order": 8,
163
+ "mode": 0,
164
+ "inputs": [
165
+ {
166
+ "name": "model",
167
+ "type": "MODEL",
168
+ "link": 16
169
+ },
170
+ {
171
+ "name": "ipadapter",
172
+ "type": "IPADAPTER",
173
+ "link": null
174
+ }
175
+ ],
176
+ "outputs": [
177
+ {
178
+ "name": "model",
179
+ "type": "MODEL",
180
+ "links": [
181
+ 47
182
+ ],
183
+ "shape": 3,
184
+ "slot_index": 0
185
+ },
186
+ {
187
+ "name": "ipadapter",
188
+ "type": "IPADAPTER",
189
+ "links": [
190
+ 48
191
+ ],
192
+ "shape": 3,
193
+ "slot_index": 1
194
+ }
195
+ ],
196
+ "properties": {
197
+ "Node name for S&R": "IPAdapterUnifiedLoader"
198
+ },
199
+ "widgets_values": [
200
+ "PLUS (high strength)"
201
+ ]
202
+ },
203
+ {
204
+ "id": 7,
205
+ "type": "CLIPTextEncode",
206
+ "pos": [
207
+ 133,
208
+ 72
209
+ ],
210
+ "size": {
211
+ "0": 425.27801513671875,
212
+ "1": 180.6060791015625
213
+ },
214
+ "flags": {},
215
+ "order": 10,
216
+ "mode": 0,
217
+ "inputs": [
218
+ {
219
+ "name": "clip",
220
+ "type": "CLIP",
221
+ "link": 5
222
+ }
223
+ ],
224
+ "outputs": [
225
+ {
226
+ "name": "CONDITIONING",
227
+ "type": "CONDITIONING",
228
+ "links": [
229
+ 76
230
+ ],
231
+ "slot_index": 0
232
+ }
233
+ ],
234
+ "properties": {
235
+ "Node name for S&R": "CLIPTextEncode"
236
+ },
237
+ "widgets_values": [
238
+ "blurry, glitches, artifact, distorted, malformed, dirt, eyeglasses"
239
+ ]
240
+ },
241
+ {
242
+ "id": 38,
243
+ "type": "EmptyLatentImage",
244
+ "pos": [
245
+ 341,
246
+ 324
247
+ ],
248
+ "size": [
249
+ 210,
250
+ 106
251
+ ],
252
+ "flags": {},
253
+ "order": 1,
254
+ "mode": 0,
255
+ "outputs": [
256
+ {
257
+ "name": "LATENT",
258
+ "type": "LATENT",
259
+ "links": [
260
+ 78
261
+ ],
262
+ "shape": 3,
263
+ "slot_index": 0
264
+ }
265
+ ],
266
+ "properties": {
267
+ "Node name for S&R": "EmptyLatentImage"
268
+ },
269
+ "widgets_values": [
270
+ 1024,
271
+ 1024,
272
+ 1
273
+ ]
274
+ },
275
+ {
276
+ "id": 32,
277
+ "type": "KSampler",
278
+ "pos": [
279
+ 722,
280
+ -129
281
+ ],
282
+ "size": {
283
+ "0": 315,
284
+ "1": 262
285
+ },
286
+ "flags": {},
287
+ "order": 15,
288
+ "mode": 0,
289
+ "inputs": [
290
+ {
291
+ "name": "model",
292
+ "type": "MODEL",
293
+ "link": 58
294
+ },
295
+ {
296
+ "name": "positive",
297
+ "type": "CONDITIONING",
298
+ "link": 75
299
+ },
300
+ {
301
+ "name": "negative",
302
+ "type": "CONDITIONING",
303
+ "link": 76
304
+ },
305
+ {
306
+ "name": "latent_image",
307
+ "type": "LATENT",
308
+ "link": 78
309
+ }
310
+ ],
311
+ "outputs": [
312
+ {
313
+ "name": "LATENT",
314
+ "type": "LATENT",
315
+ "links": [
316
+ 61
317
+ ],
318
+ "slot_index": 0
319
+ }
320
+ ],
321
+ "properties": {
322
+ "Node name for S&R": "KSampler"
323
+ },
324
+ "widgets_values": [
325
+ 3,
326
+ "fixed",
327
+ 30,
328
+ 5,
329
+ "dpmpp_2m",
330
+ "karras",
331
+ 1
332
+ ]
333
+ },
334
+ {
335
+ "id": 33,
336
+ "type": "VAEDecode",
337
+ "pos": [
338
+ 1107,
339
+ -130
340
+ ],
341
+ "size": {
342
+ "0": 140,
343
+ "1": 46
344
+ },
345
+ "flags": {
346
+ "collapsed": false
347
+ },
348
+ "order": 16,
349
+ "mode": 0,
350
+ "inputs": [
351
+ {
352
+ "name": "samples",
353
+ "type": "LATENT",
354
+ "link": 61
355
+ },
356
+ {
357
+ "name": "vae",
358
+ "type": "VAE",
359
+ "link": 59
360
+ }
361
+ ],
362
+ "outputs": [
363
+ {
364
+ "name": "IMAGE",
365
+ "type": "IMAGE",
366
+ "links": [
367
+ 60
368
+ ],
369
+ "slot_index": 0
370
+ }
371
+ ],
372
+ "properties": {
373
+ "Node name for S&R": "VAEDecode"
374
+ }
375
+ },
376
+ {
377
+ "id": 31,
378
+ "type": "SimpleMath+",
379
+ "pos": [
380
+ -566,
381
+ -413
382
+ ],
383
+ "size": {
384
+ "0": 210,
385
+ "1": 78
386
+ },
387
+ "flags": {},
388
+ "order": 11,
389
+ "mode": 0,
390
+ "inputs": [
391
+ {
392
+ "name": "a",
393
+ "type": "INT,FLOAT",
394
+ "link": 50
395
+ },
396
+ {
397
+ "name": "b",
398
+ "type": "INT,FLOAT",
399
+ "link": null
400
+ }
401
+ ],
402
+ "outputs": [
403
+ {
404
+ "name": "INT",
405
+ "type": "INT",
406
+ "links": [
407
+ 51,
408
+ 53
409
+ ],
410
+ "shape": 3,
411
+ "slot_index": 0
412
+ },
413
+ {
414
+ "name": "FLOAT",
415
+ "type": "FLOAT",
416
+ "links": null,
417
+ "shape": 3
418
+ }
419
+ ],
420
+ "properties": {
421
+ "Node name for S&R": "SimpleMath+"
422
+ },
423
+ "widgets_values": [
424
+ "a*224"
425
+ ]
426
+ },
427
+ {
428
+ "id": 40,
429
+ "type": "Note",
430
+ "pos": [
431
+ -548,
432
+ -578
433
+ ],
434
+ "size": [
435
+ 263.130633831987,
436
+ 106.42462429008373
437
+ ],
438
+ "flags": {},
439
+ "order": 2,
440
+ "mode": 0,
441
+ "properties": {
442
+ "text": ""
443
+ },
444
+ "widgets_values": [
445
+ "Resize the image to optimal resolution. ie: 224*number_of_tiles.\n\nThe original image should be a square bigger than 224*number_of_tiles."
446
+ ],
447
+ "color": "#432",
448
+ "bgcolor": "#653"
449
+ },
450
+ {
451
+ "id": 39,
452
+ "type": "Note",
453
+ "pos": [
454
+ -18,
455
+ -704
456
+ ],
457
+ "size": [
458
+ 210,
459
+ 69.97374358070851
460
+ ],
461
+ "flags": {},
462
+ "order": 3,
463
+ "mode": 0,
464
+ "properties": {
465
+ "text": ""
466
+ },
467
+ "widgets_values": [
468
+ "do NOT use PrepForClipVsion with the ClipVision Enhancer!"
469
+ ],
470
+ "color": "#432",
471
+ "bgcolor": "#653"
472
+ },
473
+ {
474
+ "id": 6,
475
+ "type": "CLIPTextEncode",
476
+ "pos": [
477
+ 133,
478
+ -166
479
+ ],
480
+ "size": {
481
+ "0": 422.84503173828125,
482
+ "1": 164.31304931640625
483
+ },
484
+ "flags": {},
485
+ "order": 9,
486
+ "mode": 0,
487
+ "inputs": [
488
+ {
489
+ "name": "clip",
490
+ "type": "CLIP",
491
+ "link": 3
492
+ }
493
+ ],
494
+ "outputs": [
495
+ {
496
+ "name": "CONDITIONING",
497
+ "type": "CONDITIONING",
498
+ "links": [
499
+ 75
500
+ ],
501
+ "slot_index": 0
502
+ }
503
+ ],
504
+ "properties": {
505
+ "Node name for S&R": "CLIPTextEncode"
506
+ },
507
+ "widgets_values": [
508
+ "illustration of a warrior woman with long red hair wearing a full armor with purple and gold decorations, detailed, intricate, high resolution, 4k"
509
+ ]
510
+ },
511
+ {
512
+ "id": 14,
513
+ "type": "LoadImage",
514
+ "pos": [
515
+ -1306,
516
+ -677
517
+ ],
518
+ "size": [
519
+ 397.77813257424236,
520
+ 475.1389358531744
521
+ ],
522
+ "flags": {},
523
+ "order": 4,
524
+ "mode": 0,
525
+ "outputs": [
526
+ {
527
+ "name": "IMAGE",
528
+ "type": "IMAGE",
529
+ "links": [
530
+ 79
531
+ ],
532
+ "shape": 3,
533
+ "slot_index": 0
534
+ },
535
+ {
536
+ "name": "MASK",
537
+ "type": "MASK",
538
+ "links": null,
539
+ "shape": 3
540
+ }
541
+ ],
542
+ "properties": {
543
+ "Node name for S&R": "LoadImage"
544
+ },
545
+ "widgets_values": [
546
+ "warrior_woman.png",
547
+ "image"
548
+ ]
549
+ },
550
+ {
551
+ "id": 28,
552
+ "type": "IPAdapterClipVisionEnhancer",
553
+ "pos": [
554
+ 220,
555
+ -620
556
+ ],
557
+ "size": [
558
+ 315,
559
+ 326
560
+ ],
561
+ "flags": {},
562
+ "order": 14,
563
+ "mode": 0,
564
+ "inputs": [
565
+ {
566
+ "name": "model",
567
+ "type": "MODEL",
568
+ "link": 47
569
+ },
570
+ {
571
+ "name": "ipadapter",
572
+ "type": "IPADAPTER",
573
+ "link": 48
574
+ },
575
+ {
576
+ "name": "image",
577
+ "type": "IMAGE",
578
+ "link": 68
579
+ },
580
+ {
581
+ "name": "image_negative",
582
+ "type": "IMAGE",
583
+ "link": null
584
+ },
585
+ {
586
+ "name": "attn_mask",
587
+ "type": "MASK",
588
+ "link": null
589
+ },
590
+ {
591
+ "name": "clip_vision",
592
+ "type": "CLIP_VISION",
593
+ "link": null
594
+ },
595
+ {
596
+ "name": "enhance_tiles",
597
+ "type": "INT",
598
+ "link": 62,
599
+ "widget": {
600
+ "name": "enhance_tiles"
601
+ }
602
+ }
603
+ ],
604
+ "outputs": [
605
+ {
606
+ "name": "MODEL",
607
+ "type": "MODEL",
608
+ "links": [
609
+ 58
610
+ ],
611
+ "shape": 3,
612
+ "slot_index": 0
613
+ }
614
+ ],
615
+ "properties": {
616
+ "Node name for S&R": "IPAdapterClipVisionEnhancer"
617
+ },
618
+ "widgets_values": [
619
+ 0.8,
620
+ "linear",
621
+ "average",
622
+ 0,
623
+ 1,
624
+ "V only",
625
+ 2,
626
+ 0.8
627
+ ]
628
+ },
629
+ {
630
+ "id": 34,
631
+ "type": "PreviewImage",
632
+ "pos": [
633
+ 1323,
634
+ -132
635
+ ],
636
+ "size": [
637
+ 1072.0986508932788,
638
+ 1107.239719497359
639
+ ],
640
+ "flags": {},
641
+ "order": 17,
642
+ "mode": 0,
643
+ "inputs": [
644
+ {
645
+ "name": "images",
646
+ "type": "IMAGE",
647
+ "link": 60
648
+ }
649
+ ],
650
+ "properties": {
651
+ "Node name for S&R": "PreviewImage"
652
+ }
653
+ },
654
+ {
655
+ "id": 41,
656
+ "type": "Note",
657
+ "pos": [
658
+ 557,
659
+ -390
660
+ ],
661
+ "size": [
662
+ 243.5294064400009,
663
+ 162.67339782886762
664
+ ],
665
+ "flags": {},
666
+ "order": 5,
667
+ "mode": 0,
668
+ "properties": {
669
+ "text": ""
670
+ },
671
+ "widgets_values": [
672
+ "if the workflow has other conditioning for the composition (like a composition IPAdapter or a controlnet) you can lower the \"enhance_ratio\" to get more details (0-0.5).\n\nIn absence of other conditioning this should be pretty high(0.5-1.0)."
673
+ ],
674
+ "color": "#432",
675
+ "bgcolor": "#653"
676
+ },
677
+ {
678
+ "id": 42,
679
+ "type": "Note",
680
+ "pos": [
681
+ -848,
682
+ -389
683
+ ],
684
+ "size": [
685
+ 216.56958342785583,
686
+ 79.05427068195002
687
+ ],
688
+ "flags": {},
689
+ "order": 6,
690
+ "mode": 0,
691
+ "properties": {
692
+ "text": ""
693
+ },
694
+ "widgets_values": [
695
+ "If you set this to 1 it will be the same as standard IPAdapter without enhancement."
696
+ ],
697
+ "color": "#432",
698
+ "bgcolor": "#653"
699
+ },
700
+ {
701
+ "id": 30,
702
+ "type": "SimpleMath+",
703
+ "pos": [
704
+ -851,
705
+ -514
706
+ ],
707
+ "size": [
708
+ 210,
709
+ 78
710
+ ],
711
+ "flags": {},
712
+ "order": 7,
713
+ "mode": 0,
714
+ "inputs": [
715
+ {
716
+ "name": "a",
717
+ "type": "INT,FLOAT",
718
+ "link": null
719
+ },
720
+ {
721
+ "name": "b",
722
+ "type": "INT,FLOAT",
723
+ "link": null
724
+ }
725
+ ],
726
+ "outputs": [
727
+ {
728
+ "name": "INT",
729
+ "type": "INT",
730
+ "links": [
731
+ 50,
732
+ 62
733
+ ],
734
+ "shape": 3,
735
+ "slot_index": 0
736
+ },
737
+ {
738
+ "name": "FLOAT",
739
+ "type": "FLOAT",
740
+ "links": null,
741
+ "shape": 3
742
+ }
743
+ ],
744
+ "properties": {
745
+ "Node name for S&R": "SimpleMath+"
746
+ },
747
+ "widgets_values": [
748
+ "3"
749
+ ]
750
+ }
751
+ ],
752
+ "links": [
753
+ [
754
+ 3,
755
+ 4,
756
+ 1,
757
+ 6,
758
+ 0,
759
+ "CLIP"
760
+ ],
761
+ [
762
+ 5,
763
+ 4,
764
+ 1,
765
+ 7,
766
+ 0,
767
+ "CLIP"
768
+ ],
769
+ [
770
+ 16,
771
+ 4,
772
+ 0,
773
+ 13,
774
+ 0,
775
+ "MODEL"
776
+ ],
777
+ [
778
+ 47,
779
+ 13,
780
+ 0,
781
+ 28,
782
+ 0,
783
+ "MODEL"
784
+ ],
785
+ [
786
+ 48,
787
+ 13,
788
+ 1,
789
+ 28,
790
+ 1,
791
+ "IPADAPTER"
792
+ ],
793
+ [
794
+ 50,
795
+ 30,
796
+ 0,
797
+ 31,
798
+ 0,
799
+ "INT,FLOAT"
800
+ ],
801
+ [
802
+ 51,
803
+ 31,
804
+ 0,
805
+ 29,
806
+ 1,
807
+ "INT"
808
+ ],
809
+ [
810
+ 53,
811
+ 31,
812
+ 0,
813
+ 29,
814
+ 2,
815
+ "INT"
816
+ ],
817
+ [
818
+ 58,
819
+ 28,
820
+ 0,
821
+ 32,
822
+ 0,
823
+ "MODEL"
824
+ ],
825
+ [
826
+ 59,
827
+ 4,
828
+ 2,
829
+ 33,
830
+ 1,
831
+ "VAE"
832
+ ],
833
+ [
834
+ 60,
835
+ 33,
836
+ 0,
837
+ 34,
838
+ 0,
839
+ "IMAGE"
840
+ ],
841
+ [
842
+ 61,
843
+ 32,
844
+ 0,
845
+ 33,
846
+ 0,
847
+ "LATENT"
848
+ ],
849
+ [
850
+ 62,
851
+ 30,
852
+ 0,
853
+ 28,
854
+ 6,
855
+ "INT"
856
+ ],
857
+ [
858
+ 67,
859
+ 29,
860
+ 0,
861
+ 36,
862
+ 0,
863
+ "IMAGE"
864
+ ],
865
+ [
866
+ 68,
867
+ 36,
868
+ 0,
869
+ 28,
870
+ 2,
871
+ "IMAGE"
872
+ ],
873
+ [
874
+ 75,
875
+ 6,
876
+ 0,
877
+ 32,
878
+ 1,
879
+ "CONDITIONING"
880
+ ],
881
+ [
882
+ 76,
883
+ 7,
884
+ 0,
885
+ 32,
886
+ 2,
887
+ "CONDITIONING"
888
+ ],
889
+ [
890
+ 78,
891
+ 38,
892
+ 0,
893
+ 32,
894
+ 3,
895
+ "LATENT"
896
+ ],
897
+ [
898
+ 79,
899
+ 14,
900
+ 0,
901
+ 29,
902
+ 0,
903
+ "IMAGE"
904
+ ]
905
+ ],
906
+ "groups": [],
907
+ "config": {},
908
+ "extra": {
909
+ "ds": {
910
+ "scale": 0.3558410273836744,
911
+ "offset": {
912
+ "0": 3138.218919113904,
913
+ "1": 1855.039899518089
914
+ }
915
+ }
916
+ },
917
+ "version": 0.4
918
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_combine_embeds.json ADDED
@@ -0,0 +1,1542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 51,
3
+ "last_link_id": 118,
4
+ "nodes": [
5
+ {
6
+ "id": 5,
7
+ "type": "EmptyLatentImage",
8
+ "pos": [
9
+ 801,
10
+ 1097
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 106
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "LATENT",
22
+ "type": "LATENT",
23
+ "links": [
24
+ 2,
25
+ 89,
26
+ 100,
27
+ 111
28
+ ],
29
+ "slot_index": 0
30
+ }
31
+ ],
32
+ "properties": {
33
+ "Node name for S&R": "EmptyLatentImage"
34
+ },
35
+ "widgets_values": [
36
+ 512,
37
+ 512,
38
+ 1
39
+ ]
40
+ },
41
+ {
42
+ "id": 3,
43
+ "type": "KSampler",
44
+ "pos": [
45
+ 1580,
46
+ 300
47
+ ],
48
+ "size": {
49
+ "0": 315,
50
+ "1": 262
51
+ },
52
+ "flags": {},
53
+ "order": 13,
54
+ "mode": 0,
55
+ "inputs": [
56
+ {
57
+ "name": "model",
58
+ "type": "MODEL",
59
+ "link": 23
60
+ },
61
+ {
62
+ "name": "positive",
63
+ "type": "CONDITIONING",
64
+ "link": 4
65
+ },
66
+ {
67
+ "name": "negative",
68
+ "type": "CONDITIONING",
69
+ "link": 6
70
+ },
71
+ {
72
+ "name": "latent_image",
73
+ "type": "LATENT",
74
+ "link": 2
75
+ }
76
+ ],
77
+ "outputs": [
78
+ {
79
+ "name": "LATENT",
80
+ "type": "LATENT",
81
+ "links": [
82
+ 7
83
+ ],
84
+ "slot_index": 0
85
+ }
86
+ ],
87
+ "properties": {
88
+ "Node name for S&R": "KSampler"
89
+ },
90
+ "widgets_values": [
91
+ 0,
92
+ "fixed",
93
+ 30,
94
+ 6.5,
95
+ "dpmpp_2m",
96
+ "karras",
97
+ 1
98
+ ]
99
+ },
100
+ {
101
+ "id": 4,
102
+ "type": "CheckpointLoaderSimple",
103
+ "pos": [
104
+ 300,
105
+ 700
106
+ ],
107
+ "size": {
108
+ "0": 315,
109
+ "1": 98
110
+ },
111
+ "flags": {},
112
+ "order": 1,
113
+ "mode": 0,
114
+ "outputs": [
115
+ {
116
+ "name": "MODEL",
117
+ "type": "MODEL",
118
+ "links": [
119
+ 20,
120
+ 93,
121
+ 104,
122
+ 115
123
+ ],
124
+ "slot_index": 0
125
+ },
126
+ {
127
+ "name": "CLIP",
128
+ "type": "CLIP",
129
+ "links": [
130
+ 3,
131
+ 5
132
+ ],
133
+ "slot_index": 1
134
+ },
135
+ {
136
+ "name": "VAE",
137
+ "type": "VAE",
138
+ "links": [
139
+ 8,
140
+ 91,
141
+ 102,
142
+ 113
143
+ ],
144
+ "slot_index": 2
145
+ }
146
+ ],
147
+ "properties": {
148
+ "Node name for S&R": "CheckpointLoaderSimple"
149
+ },
150
+ "widgets_values": [
151
+ "sd15/realisticVisionV51_v51VAE.safetensors"
152
+ ]
153
+ },
154
+ {
155
+ "id": 12,
156
+ "type": "LoadImage",
157
+ "pos": [
158
+ 240,
159
+ -60
160
+ ],
161
+ "size": {
162
+ "0": 315,
163
+ "1": 314
164
+ },
165
+ "flags": {},
166
+ "order": 2,
167
+ "mode": 0,
168
+ "outputs": [
169
+ {
170
+ "name": "IMAGE",
171
+ "type": "IMAGE",
172
+ "links": [
173
+ 83
174
+ ],
175
+ "shape": 3,
176
+ "slot_index": 0
177
+ },
178
+ {
179
+ "name": "MASK",
180
+ "type": "MASK",
181
+ "links": null,
182
+ "shape": 3
183
+ }
184
+ ],
185
+ "properties": {
186
+ "Node name for S&R": "LoadImage"
187
+ },
188
+ "widgets_values": [
189
+ "warrior_woman.png",
190
+ "image"
191
+ ]
192
+ },
193
+ {
194
+ "id": 7,
195
+ "type": "CLIPTextEncode",
196
+ "pos": [
197
+ 740,
198
+ 780
199
+ ],
200
+ "size": {
201
+ "0": 425.27801513671875,
202
+ "1": 180.6060791015625
203
+ },
204
+ "flags": {},
205
+ "order": 7,
206
+ "mode": 0,
207
+ "inputs": [
208
+ {
209
+ "name": "clip",
210
+ "type": "CLIP",
211
+ "link": 5
212
+ }
213
+ ],
214
+ "outputs": [
215
+ {
216
+ "name": "CONDITIONING",
217
+ "type": "CONDITIONING",
218
+ "links": [
219
+ 6,
220
+ 88,
221
+ 99,
222
+ 110
223
+ ],
224
+ "slot_index": 0
225
+ }
226
+ ],
227
+ "properties": {
228
+ "Node name for S&R": "CLIPTextEncode"
229
+ },
230
+ "widgets_values": [
231
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
232
+ ]
233
+ },
234
+ {
235
+ "id": 14,
236
+ "type": "IPAdapterAdvanced",
237
+ "pos": [
238
+ 1220,
239
+ 260
240
+ ],
241
+ "size": {
242
+ "0": 315,
243
+ "1": 278
244
+ },
245
+ "flags": {},
246
+ "order": 9,
247
+ "mode": 0,
248
+ "inputs": [
249
+ {
250
+ "name": "model",
251
+ "type": "MODEL",
252
+ "link": 20
253
+ },
254
+ {
255
+ "name": "ipadapter",
256
+ "type": "IPADAPTER",
257
+ "link": 21,
258
+ "slot_index": 1
259
+ },
260
+ {
261
+ "name": "image",
262
+ "type": "IMAGE",
263
+ "link": 85
264
+ },
265
+ {
266
+ "name": "image_negative",
267
+ "type": "IMAGE",
268
+ "link": null
269
+ },
270
+ {
271
+ "name": "attn_mask",
272
+ "type": "MASK",
273
+ "link": null
274
+ },
275
+ {
276
+ "name": "clip_vision",
277
+ "type": "CLIP_VISION",
278
+ "link": 24,
279
+ "slot_index": 5
280
+ }
281
+ ],
282
+ "outputs": [
283
+ {
284
+ "name": "MODEL",
285
+ "type": "MODEL",
286
+ "links": [
287
+ 23
288
+ ],
289
+ "shape": 3,
290
+ "slot_index": 0
291
+ }
292
+ ],
293
+ "properties": {
294
+ "Node name for S&R": "IPAdapterAdvanced"
295
+ },
296
+ "widgets_values": [
297
+ 0.8,
298
+ "linear",
299
+ "concat",
300
+ 0,
301
+ 1,
302
+ "V only"
303
+ ]
304
+ },
305
+ {
306
+ "id": 42,
307
+ "type": "SaveImage",
308
+ "pos": [
309
+ 1950,
310
+ 1070
311
+ ],
312
+ "size": {
313
+ "0": 529.7760009765625,
314
+ "1": 582.3048095703125
315
+ },
316
+ "flags": {},
317
+ "order": 22,
318
+ "mode": 0,
319
+ "inputs": [
320
+ {
321
+ "name": "images",
322
+ "type": "IMAGE",
323
+ "link": 92
324
+ }
325
+ ],
326
+ "properties": {},
327
+ "widgets_values": [
328
+ "IPAdapter"
329
+ ]
330
+ },
331
+ {
332
+ "id": 40,
333
+ "type": "KSampler",
334
+ "pos": [
335
+ 1580,
336
+ 1070
337
+ ],
338
+ "size": {
339
+ "0": 315,
340
+ "1": 262
341
+ },
342
+ "flags": {},
343
+ "order": 14,
344
+ "mode": 0,
345
+ "inputs": [
346
+ {
347
+ "name": "model",
348
+ "type": "MODEL",
349
+ "link": 86
350
+ },
351
+ {
352
+ "name": "positive",
353
+ "type": "CONDITIONING",
354
+ "link": 87
355
+ },
356
+ {
357
+ "name": "negative",
358
+ "type": "CONDITIONING",
359
+ "link": 88
360
+ },
361
+ {
362
+ "name": "latent_image",
363
+ "type": "LATENT",
364
+ "link": 89
365
+ }
366
+ ],
367
+ "outputs": [
368
+ {
369
+ "name": "LATENT",
370
+ "type": "LATENT",
371
+ "links": [
372
+ 90
373
+ ],
374
+ "slot_index": 0
375
+ }
376
+ ],
377
+ "properties": {
378
+ "Node name for S&R": "KSampler"
379
+ },
380
+ "widgets_values": [
381
+ 0,
382
+ "fixed",
383
+ 30,
384
+ 6.5,
385
+ "dpmpp_2m",
386
+ "karras",
387
+ 1
388
+ ]
389
+ },
390
+ {
391
+ "id": 9,
392
+ "type": "SaveImage",
393
+ "pos": [
394
+ 1950,
395
+ 420
396
+ ],
397
+ "size": {
398
+ "0": 529.7760009765625,
399
+ "1": 582.3048095703125
400
+ },
401
+ "flags": {},
402
+ "order": 21,
403
+ "mode": 0,
404
+ "inputs": [
405
+ {
406
+ "name": "images",
407
+ "type": "IMAGE",
408
+ "link": 9
409
+ }
410
+ ],
411
+ "properties": {},
412
+ "widgets_values": [
413
+ "IPAdapter"
414
+ ]
415
+ },
416
+ {
417
+ "id": 6,
418
+ "type": "CLIPTextEncode",
419
+ "pos": [
420
+ 740,
421
+ 550
422
+ ],
423
+ "size": {
424
+ "0": 422.84503173828125,
425
+ "1": 164.31304931640625
426
+ },
427
+ "flags": {},
428
+ "order": 6,
429
+ "mode": 0,
430
+ "inputs": [
431
+ {
432
+ "name": "clip",
433
+ "type": "CLIP",
434
+ "link": 3
435
+ }
436
+ ],
437
+ "outputs": [
438
+ {
439
+ "name": "CONDITIONING",
440
+ "type": "CONDITIONING",
441
+ "links": [
442
+ 4,
443
+ 87,
444
+ 98,
445
+ 109
446
+ ],
447
+ "slot_index": 0
448
+ }
449
+ ],
450
+ "properties": {
451
+ "Node name for S&R": "CLIPTextEncode"
452
+ },
453
+ "widgets_values": [
454
+ "closeup of a fierce warrior woman wearing a full armor at the end of a battle\n\nhigh quality, detailed"
455
+ ]
456
+ },
457
+ {
458
+ "id": 15,
459
+ "type": "IPAdapterModelLoader",
460
+ "pos": [
461
+ 650,
462
+ -20
463
+ ],
464
+ "size": {
465
+ "0": 315,
466
+ "1": 58
467
+ },
468
+ "flags": {},
469
+ "order": 3,
470
+ "mode": 0,
471
+ "outputs": [
472
+ {
473
+ "name": "IPADAPTER",
474
+ "type": "IPADAPTER",
475
+ "links": [
476
+ 21,
477
+ 94,
478
+ 105,
479
+ 116
480
+ ],
481
+ "shape": 3
482
+ }
483
+ ],
484
+ "properties": {
485
+ "Node name for S&R": "IPAdapterModelLoader"
486
+ },
487
+ "widgets_values": [
488
+ "ip-adapter-plus_sd15.safetensors"
489
+ ]
490
+ },
491
+ {
492
+ "id": 39,
493
+ "type": "ImageBatch",
494
+ "pos": [
495
+ 714,
496
+ 287
497
+ ],
498
+ "size": {
499
+ "0": 210,
500
+ "1": 46
501
+ },
502
+ "flags": {},
503
+ "order": 8,
504
+ "mode": 0,
505
+ "inputs": [
506
+ {
507
+ "name": "image1",
508
+ "type": "IMAGE",
509
+ "link": 83
510
+ },
511
+ {
512
+ "name": "image2",
513
+ "type": "IMAGE",
514
+ "link": 84
515
+ }
516
+ ],
517
+ "outputs": [
518
+ {
519
+ "name": "IMAGE",
520
+ "type": "IMAGE",
521
+ "links": [
522
+ 85,
523
+ 95,
524
+ 106,
525
+ 117
526
+ ],
527
+ "shape": 3,
528
+ "slot_index": 0
529
+ }
530
+ ],
531
+ "properties": {
532
+ "Node name for S&R": "ImageBatch"
533
+ }
534
+ },
535
+ {
536
+ "id": 38,
537
+ "type": "LoadImage",
538
+ "pos": [
539
+ 240,
540
+ 310
541
+ ],
542
+ "size": {
543
+ "0": 315,
544
+ "1": 314
545
+ },
546
+ "flags": {},
547
+ "order": 4,
548
+ "mode": 0,
549
+ "outputs": [
550
+ {
551
+ "name": "IMAGE",
552
+ "type": "IMAGE",
553
+ "links": [
554
+ 84
555
+ ],
556
+ "shape": 3,
557
+ "slot_index": 0
558
+ },
559
+ {
560
+ "name": "MASK",
561
+ "type": "MASK",
562
+ "links": null,
563
+ "shape": 3
564
+ }
565
+ ],
566
+ "properties": {
567
+ "Node name for S&R": "LoadImage"
568
+ },
569
+ "widgets_values": [
570
+ "anime_illustration.png",
571
+ "image"
572
+ ]
573
+ },
574
+ {
575
+ "id": 43,
576
+ "type": "IPAdapterAdvanced",
577
+ "pos": [
578
+ 1220,
579
+ 1030
580
+ ],
581
+ "size": {
582
+ "0": 315,
583
+ "1": 278
584
+ },
585
+ "flags": {},
586
+ "order": 10,
587
+ "mode": 0,
588
+ "inputs": [
589
+ {
590
+ "name": "model",
591
+ "type": "MODEL",
592
+ "link": 93
593
+ },
594
+ {
595
+ "name": "ipadapter",
596
+ "type": "IPADAPTER",
597
+ "link": 94,
598
+ "slot_index": 1
599
+ },
600
+ {
601
+ "name": "image",
602
+ "type": "IMAGE",
603
+ "link": 95
604
+ },
605
+ {
606
+ "name": "image_negative",
607
+ "type": "IMAGE",
608
+ "link": null
609
+ },
610
+ {
611
+ "name": "attn_mask",
612
+ "type": "MASK",
613
+ "link": null
614
+ },
615
+ {
616
+ "name": "clip_vision",
617
+ "type": "CLIP_VISION",
618
+ "link": 96,
619
+ "slot_index": 5
620
+ }
621
+ ],
622
+ "outputs": [
623
+ {
624
+ "name": "MODEL",
625
+ "type": "MODEL",
626
+ "links": [
627
+ 86
628
+ ],
629
+ "shape": 3,
630
+ "slot_index": 0
631
+ }
632
+ ],
633
+ "properties": {
634
+ "Node name for S&R": "IPAdapterAdvanced"
635
+ },
636
+ "widgets_values": [
637
+ 0.8,
638
+ "linear",
639
+ "add",
640
+ 0,
641
+ 1,
642
+ "V only"
643
+ ]
644
+ },
645
+ {
646
+ "id": 44,
647
+ "type": "KSampler",
648
+ "pos": [
649
+ 3470,
650
+ 390
651
+ ],
652
+ "size": {
653
+ "0": 315,
654
+ "1": 262
655
+ },
656
+ "flags": {},
657
+ "order": 15,
658
+ "mode": 0,
659
+ "inputs": [
660
+ {
661
+ "name": "model",
662
+ "type": "MODEL",
663
+ "link": 97
664
+ },
665
+ {
666
+ "name": "positive",
667
+ "type": "CONDITIONING",
668
+ "link": 98
669
+ },
670
+ {
671
+ "name": "negative",
672
+ "type": "CONDITIONING",
673
+ "link": 99
674
+ },
675
+ {
676
+ "name": "latent_image",
677
+ "type": "LATENT",
678
+ "link": 100
679
+ }
680
+ ],
681
+ "outputs": [
682
+ {
683
+ "name": "LATENT",
684
+ "type": "LATENT",
685
+ "links": [
686
+ 101
687
+ ],
688
+ "slot_index": 0
689
+ }
690
+ ],
691
+ "properties": {
692
+ "Node name for S&R": "KSampler"
693
+ },
694
+ "widgets_values": [
695
+ 0,
696
+ "fixed",
697
+ 30,
698
+ 6.5,
699
+ "dpmpp_2m",
700
+ "karras",
701
+ 1
702
+ ]
703
+ },
704
+ {
705
+ "id": 45,
706
+ "type": "VAEDecode",
707
+ "pos": [
708
+ 3840,
709
+ 400
710
+ ],
711
+ "size": {
712
+ "0": 140,
713
+ "1": 46
714
+ },
715
+ "flags": {},
716
+ "order": 19,
717
+ "mode": 0,
718
+ "inputs": [
719
+ {
720
+ "name": "samples",
721
+ "type": "LATENT",
722
+ "link": 101
723
+ },
724
+ {
725
+ "name": "vae",
726
+ "type": "VAE",
727
+ "link": 102
728
+ }
729
+ ],
730
+ "outputs": [
731
+ {
732
+ "name": "IMAGE",
733
+ "type": "IMAGE",
734
+ "links": [
735
+ 103
736
+ ],
737
+ "slot_index": 0
738
+ }
739
+ ],
740
+ "properties": {
741
+ "Node name for S&R": "VAEDecode"
742
+ }
743
+ },
744
+ {
745
+ "id": 48,
746
+ "type": "KSampler",
747
+ "pos": [
748
+ 3480,
749
+ 1170
750
+ ],
751
+ "size": {
752
+ "0": 315,
753
+ "1": 262
754
+ },
755
+ "flags": {},
756
+ "order": 16,
757
+ "mode": 0,
758
+ "inputs": [
759
+ {
760
+ "name": "model",
761
+ "type": "MODEL",
762
+ "link": 108
763
+ },
764
+ {
765
+ "name": "positive",
766
+ "type": "CONDITIONING",
767
+ "link": 109
768
+ },
769
+ {
770
+ "name": "negative",
771
+ "type": "CONDITIONING",
772
+ "link": 110
773
+ },
774
+ {
775
+ "name": "latent_image",
776
+ "type": "LATENT",
777
+ "link": 111
778
+ }
779
+ ],
780
+ "outputs": [
781
+ {
782
+ "name": "LATENT",
783
+ "type": "LATENT",
784
+ "links": [
785
+ 112
786
+ ],
787
+ "slot_index": 0
788
+ }
789
+ ],
790
+ "properties": {
791
+ "Node name for S&R": "KSampler"
792
+ },
793
+ "widgets_values": [
794
+ 0,
795
+ "fixed",
796
+ 30,
797
+ 6.5,
798
+ "dpmpp_2m",
799
+ "karras",
800
+ 1
801
+ ]
802
+ },
803
+ {
804
+ "id": 49,
805
+ "type": "VAEDecode",
806
+ "pos": [
807
+ 3850,
808
+ 1180
809
+ ],
810
+ "size": {
811
+ "0": 140,
812
+ "1": 46
813
+ },
814
+ "flags": {},
815
+ "order": 20,
816
+ "mode": 0,
817
+ "inputs": [
818
+ {
819
+ "name": "samples",
820
+ "type": "LATENT",
821
+ "link": 112
822
+ },
823
+ {
824
+ "name": "vae",
825
+ "type": "VAE",
826
+ "link": 113
827
+ }
828
+ ],
829
+ "outputs": [
830
+ {
831
+ "name": "IMAGE",
832
+ "type": "IMAGE",
833
+ "links": [
834
+ 114
835
+ ],
836
+ "slot_index": 0
837
+ }
838
+ ],
839
+ "properties": {
840
+ "Node name for S&R": "VAEDecode"
841
+ }
842
+ },
843
+ {
844
+ "id": 51,
845
+ "type": "IPAdapterAdvanced",
846
+ "pos": [
847
+ 3120,
848
+ 1130
849
+ ],
850
+ "size": {
851
+ "0": 315,
852
+ "1": 278
853
+ },
854
+ "flags": {},
855
+ "order": 12,
856
+ "mode": 0,
857
+ "inputs": [
858
+ {
859
+ "name": "model",
860
+ "type": "MODEL",
861
+ "link": 115
862
+ },
863
+ {
864
+ "name": "ipadapter",
865
+ "type": "IPADAPTER",
866
+ "link": 116,
867
+ "slot_index": 1
868
+ },
869
+ {
870
+ "name": "image",
871
+ "type": "IMAGE",
872
+ "link": 117
873
+ },
874
+ {
875
+ "name": "image_negative",
876
+ "type": "IMAGE",
877
+ "link": null
878
+ },
879
+ {
880
+ "name": "attn_mask",
881
+ "type": "MASK",
882
+ "link": null
883
+ },
884
+ {
885
+ "name": "clip_vision",
886
+ "type": "CLIP_VISION",
887
+ "link": 118,
888
+ "slot_index": 5
889
+ }
890
+ ],
891
+ "outputs": [
892
+ {
893
+ "name": "MODEL",
894
+ "type": "MODEL",
895
+ "links": [
896
+ 108
897
+ ],
898
+ "shape": 3,
899
+ "slot_index": 0
900
+ }
901
+ ],
902
+ "properties": {
903
+ "Node name for S&R": "IPAdapterAdvanced"
904
+ },
905
+ "widgets_values": [
906
+ 0.8,
907
+ "linear",
908
+ "norm average",
909
+ 0,
910
+ 1,
911
+ "V only"
912
+ ]
913
+ },
914
+ {
915
+ "id": 47,
916
+ "type": "IPAdapterAdvanced",
917
+ "pos": [
918
+ 3110,
919
+ 350
920
+ ],
921
+ "size": {
922
+ "0": 315,
923
+ "1": 278
924
+ },
925
+ "flags": {},
926
+ "order": 11,
927
+ "mode": 0,
928
+ "inputs": [
929
+ {
930
+ "name": "model",
931
+ "type": "MODEL",
932
+ "link": 104
933
+ },
934
+ {
935
+ "name": "ipadapter",
936
+ "type": "IPADAPTER",
937
+ "link": 105,
938
+ "slot_index": 1
939
+ },
940
+ {
941
+ "name": "image",
942
+ "type": "IMAGE",
943
+ "link": 106
944
+ },
945
+ {
946
+ "name": "image_negative",
947
+ "type": "IMAGE",
948
+ "link": null
949
+ },
950
+ {
951
+ "name": "attn_mask",
952
+ "type": "MASK",
953
+ "link": null
954
+ },
955
+ {
956
+ "name": "clip_vision",
957
+ "type": "CLIP_VISION",
958
+ "link": 107,
959
+ "slot_index": 5
960
+ }
961
+ ],
962
+ "outputs": [
963
+ {
964
+ "name": "MODEL",
965
+ "type": "MODEL",
966
+ "links": [
967
+ 97
968
+ ],
969
+ "shape": 3,
970
+ "slot_index": 0
971
+ }
972
+ ],
973
+ "properties": {
974
+ "Node name for S&R": "IPAdapterAdvanced"
975
+ },
976
+ "widgets_values": [
977
+ 0.8,
978
+ "linear",
979
+ "average",
980
+ 0,
981
+ 1,
982
+ "V only"
983
+ ]
984
+ },
985
+ {
986
+ "id": 8,
987
+ "type": "VAEDecode",
988
+ "pos": [
989
+ 1748,
990
+ 613
991
+ ],
992
+ "size": {
993
+ "0": 140,
994
+ "1": 46
995
+ },
996
+ "flags": {},
997
+ "order": 17,
998
+ "mode": 0,
999
+ "inputs": [
1000
+ {
1001
+ "name": "samples",
1002
+ "type": "LATENT",
1003
+ "link": 7
1004
+ },
1005
+ {
1006
+ "name": "vae",
1007
+ "type": "VAE",
1008
+ "link": 8
1009
+ }
1010
+ ],
1011
+ "outputs": [
1012
+ {
1013
+ "name": "IMAGE",
1014
+ "type": "IMAGE",
1015
+ "links": [
1016
+ 9
1017
+ ],
1018
+ "slot_index": 0
1019
+ }
1020
+ ],
1021
+ "properties": {
1022
+ "Node name for S&R": "VAEDecode"
1023
+ }
1024
+ },
1025
+ {
1026
+ "id": 41,
1027
+ "type": "VAEDecode",
1028
+ "pos": [
1029
+ 1746,
1030
+ 1386
1031
+ ],
1032
+ "size": {
1033
+ "0": 140,
1034
+ "1": 46
1035
+ },
1036
+ "flags": {},
1037
+ "order": 18,
1038
+ "mode": 0,
1039
+ "inputs": [
1040
+ {
1041
+ "name": "samples",
1042
+ "type": "LATENT",
1043
+ "link": 90
1044
+ },
1045
+ {
1046
+ "name": "vae",
1047
+ "type": "VAE",
1048
+ "link": 91
1049
+ }
1050
+ ],
1051
+ "outputs": [
1052
+ {
1053
+ "name": "IMAGE",
1054
+ "type": "IMAGE",
1055
+ "links": [
1056
+ 92
1057
+ ],
1058
+ "slot_index": 0
1059
+ }
1060
+ ],
1061
+ "properties": {
1062
+ "Node name for S&R": "VAEDecode"
1063
+ }
1064
+ },
1065
+ {
1066
+ "id": 50,
1067
+ "type": "SaveImage",
1068
+ "pos": [
1069
+ 2530,
1070
+ 1073
1071
+ ],
1072
+ "size": {
1073
+ "0": 529.7760009765625,
1074
+ "1": 582.3048095703125
1075
+ },
1076
+ "flags": {},
1077
+ "order": 24,
1078
+ "mode": 0,
1079
+ "inputs": [
1080
+ {
1081
+ "name": "images",
1082
+ "type": "IMAGE",
1083
+ "link": 114
1084
+ }
1085
+ ],
1086
+ "properties": {},
1087
+ "widgets_values": [
1088
+ "IPAdapter"
1089
+ ]
1090
+ },
1091
+ {
1092
+ "id": 46,
1093
+ "type": "SaveImage",
1094
+ "pos": [
1095
+ 2518,
1096
+ 419
1097
+ ],
1098
+ "size": {
1099
+ "0": 529.7760009765625,
1100
+ "1": 582.3048095703125
1101
+ },
1102
+ "flags": {},
1103
+ "order": 23,
1104
+ "mode": 0,
1105
+ "inputs": [
1106
+ {
1107
+ "name": "images",
1108
+ "type": "IMAGE",
1109
+ "link": 103
1110
+ }
1111
+ ],
1112
+ "properties": {},
1113
+ "widgets_values": [
1114
+ "IPAdapter"
1115
+ ]
1116
+ },
1117
+ {
1118
+ "id": 16,
1119
+ "type": "CLIPVisionLoader",
1120
+ "pos": [
1121
+ 650,
1122
+ 80
1123
+ ],
1124
+ "size": {
1125
+ "0": 315,
1126
+ "1": 58
1127
+ },
1128
+ "flags": {},
1129
+ "order": 5,
1130
+ "mode": 0,
1131
+ "outputs": [
1132
+ {
1133
+ "name": "CLIP_VISION",
1134
+ "type": "CLIP_VISION",
1135
+ "links": [
1136
+ 24,
1137
+ 96,
1138
+ 107,
1139
+ 118
1140
+ ],
1141
+ "shape": 3
1142
+ }
1143
+ ],
1144
+ "properties": {
1145
+ "Node name for S&R": "CLIPVisionLoader"
1146
+ },
1147
+ "widgets_values": [
1148
+ "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors"
1149
+ ]
1150
+ }
1151
+ ],
1152
+ "links": [
1153
+ [
1154
+ 2,
1155
+ 5,
1156
+ 0,
1157
+ 3,
1158
+ 3,
1159
+ "LATENT"
1160
+ ],
1161
+ [
1162
+ 3,
1163
+ 4,
1164
+ 1,
1165
+ 6,
1166
+ 0,
1167
+ "CLIP"
1168
+ ],
1169
+ [
1170
+ 4,
1171
+ 6,
1172
+ 0,
1173
+ 3,
1174
+ 1,
1175
+ "CONDITIONING"
1176
+ ],
1177
+ [
1178
+ 5,
1179
+ 4,
1180
+ 1,
1181
+ 7,
1182
+ 0,
1183
+ "CLIP"
1184
+ ],
1185
+ [
1186
+ 6,
1187
+ 7,
1188
+ 0,
1189
+ 3,
1190
+ 2,
1191
+ "CONDITIONING"
1192
+ ],
1193
+ [
1194
+ 7,
1195
+ 3,
1196
+ 0,
1197
+ 8,
1198
+ 0,
1199
+ "LATENT"
1200
+ ],
1201
+ [
1202
+ 8,
1203
+ 4,
1204
+ 2,
1205
+ 8,
1206
+ 1,
1207
+ "VAE"
1208
+ ],
1209
+ [
1210
+ 9,
1211
+ 8,
1212
+ 0,
1213
+ 9,
1214
+ 0,
1215
+ "IMAGE"
1216
+ ],
1217
+ [
1218
+ 20,
1219
+ 4,
1220
+ 0,
1221
+ 14,
1222
+ 0,
1223
+ "MODEL"
1224
+ ],
1225
+ [
1226
+ 21,
1227
+ 15,
1228
+ 0,
1229
+ 14,
1230
+ 1,
1231
+ "IPADAPTER"
1232
+ ],
1233
+ [
1234
+ 23,
1235
+ 14,
1236
+ 0,
1237
+ 3,
1238
+ 0,
1239
+ "MODEL"
1240
+ ],
1241
+ [
1242
+ 24,
1243
+ 16,
1244
+ 0,
1245
+ 14,
1246
+ 5,
1247
+ "CLIP_VISION"
1248
+ ],
1249
+ [
1250
+ 83,
1251
+ 12,
1252
+ 0,
1253
+ 39,
1254
+ 0,
1255
+ "IMAGE"
1256
+ ],
1257
+ [
1258
+ 84,
1259
+ 38,
1260
+ 0,
1261
+ 39,
1262
+ 1,
1263
+ "IMAGE"
1264
+ ],
1265
+ [
1266
+ 85,
1267
+ 39,
1268
+ 0,
1269
+ 14,
1270
+ 2,
1271
+ "IMAGE"
1272
+ ],
1273
+ [
1274
+ 86,
1275
+ 43,
1276
+ 0,
1277
+ 40,
1278
+ 0,
1279
+ "MODEL"
1280
+ ],
1281
+ [
1282
+ 87,
1283
+ 6,
1284
+ 0,
1285
+ 40,
1286
+ 1,
1287
+ "CONDITIONING"
1288
+ ],
1289
+ [
1290
+ 88,
1291
+ 7,
1292
+ 0,
1293
+ 40,
1294
+ 2,
1295
+ "CONDITIONING"
1296
+ ],
1297
+ [
1298
+ 89,
1299
+ 5,
1300
+ 0,
1301
+ 40,
1302
+ 3,
1303
+ "LATENT"
1304
+ ],
1305
+ [
1306
+ 90,
1307
+ 40,
1308
+ 0,
1309
+ 41,
1310
+ 0,
1311
+ "LATENT"
1312
+ ],
1313
+ [
1314
+ 91,
1315
+ 4,
1316
+ 2,
1317
+ 41,
1318
+ 1,
1319
+ "VAE"
1320
+ ],
1321
+ [
1322
+ 92,
1323
+ 41,
1324
+ 0,
1325
+ 42,
1326
+ 0,
1327
+ "IMAGE"
1328
+ ],
1329
+ [
1330
+ 93,
1331
+ 4,
1332
+ 0,
1333
+ 43,
1334
+ 0,
1335
+ "MODEL"
1336
+ ],
1337
+ [
1338
+ 94,
1339
+ 15,
1340
+ 0,
1341
+ 43,
1342
+ 1,
1343
+ "IPADAPTER"
1344
+ ],
1345
+ [
1346
+ 95,
1347
+ 39,
1348
+ 0,
1349
+ 43,
1350
+ 2,
1351
+ "IMAGE"
1352
+ ],
1353
+ [
1354
+ 96,
1355
+ 16,
1356
+ 0,
1357
+ 43,
1358
+ 5,
1359
+ "CLIP_VISION"
1360
+ ],
1361
+ [
1362
+ 97,
1363
+ 47,
1364
+ 0,
1365
+ 44,
1366
+ 0,
1367
+ "MODEL"
1368
+ ],
1369
+ [
1370
+ 98,
1371
+ 6,
1372
+ 0,
1373
+ 44,
1374
+ 1,
1375
+ "CONDITIONING"
1376
+ ],
1377
+ [
1378
+ 99,
1379
+ 7,
1380
+ 0,
1381
+ 44,
1382
+ 2,
1383
+ "CONDITIONING"
1384
+ ],
1385
+ [
1386
+ 100,
1387
+ 5,
1388
+ 0,
1389
+ 44,
1390
+ 3,
1391
+ "LATENT"
1392
+ ],
1393
+ [
1394
+ 101,
1395
+ 44,
1396
+ 0,
1397
+ 45,
1398
+ 0,
1399
+ "LATENT"
1400
+ ],
1401
+ [
1402
+ 102,
1403
+ 4,
1404
+ 2,
1405
+ 45,
1406
+ 1,
1407
+ "VAE"
1408
+ ],
1409
+ [
1410
+ 103,
1411
+ 45,
1412
+ 0,
1413
+ 46,
1414
+ 0,
1415
+ "IMAGE"
1416
+ ],
1417
+ [
1418
+ 104,
1419
+ 4,
1420
+ 0,
1421
+ 47,
1422
+ 0,
1423
+ "MODEL"
1424
+ ],
1425
+ [
1426
+ 105,
1427
+ 15,
1428
+ 0,
1429
+ 47,
1430
+ 1,
1431
+ "IPADAPTER"
1432
+ ],
1433
+ [
1434
+ 106,
1435
+ 39,
1436
+ 0,
1437
+ 47,
1438
+ 2,
1439
+ "IMAGE"
1440
+ ],
1441
+ [
1442
+ 107,
1443
+ 16,
1444
+ 0,
1445
+ 47,
1446
+ 5,
1447
+ "CLIP_VISION"
1448
+ ],
1449
+ [
1450
+ 108,
1451
+ 51,
1452
+ 0,
1453
+ 48,
1454
+ 0,
1455
+ "MODEL"
1456
+ ],
1457
+ [
1458
+ 109,
1459
+ 6,
1460
+ 0,
1461
+ 48,
1462
+ 1,
1463
+ "CONDITIONING"
1464
+ ],
1465
+ [
1466
+ 110,
1467
+ 7,
1468
+ 0,
1469
+ 48,
1470
+ 2,
1471
+ "CONDITIONING"
1472
+ ],
1473
+ [
1474
+ 111,
1475
+ 5,
1476
+ 0,
1477
+ 48,
1478
+ 3,
1479
+ "LATENT"
1480
+ ],
1481
+ [
1482
+ 112,
1483
+ 48,
1484
+ 0,
1485
+ 49,
1486
+ 0,
1487
+ "LATENT"
1488
+ ],
1489
+ [
1490
+ 113,
1491
+ 4,
1492
+ 2,
1493
+ 49,
1494
+ 1,
1495
+ "VAE"
1496
+ ],
1497
+ [
1498
+ 114,
1499
+ 49,
1500
+ 0,
1501
+ 50,
1502
+ 0,
1503
+ "IMAGE"
1504
+ ],
1505
+ [
1506
+ 115,
1507
+ 4,
1508
+ 0,
1509
+ 51,
1510
+ 0,
1511
+ "MODEL"
1512
+ ],
1513
+ [
1514
+ 116,
1515
+ 15,
1516
+ 0,
1517
+ 51,
1518
+ 1,
1519
+ "IPADAPTER"
1520
+ ],
1521
+ [
1522
+ 117,
1523
+ 39,
1524
+ 0,
1525
+ 51,
1526
+ 2,
1527
+ "IMAGE"
1528
+ ],
1529
+ [
1530
+ 118,
1531
+ 16,
1532
+ 0,
1533
+ 51,
1534
+ 5,
1535
+ "CLIP_VISION"
1536
+ ]
1537
+ ],
1538
+ "groups": [],
1539
+ "config": {},
1540
+ "extra": {},
1541
+ "version": 0.4
1542
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_cosxl_edit.json ADDED
@@ -0,0 +1,1624 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 59,
3
+ "last_link_id": 468,
4
+ "nodes": [
5
+ {
6
+ "id": 44,
7
+ "type": "BasicScheduler",
8
+ "pos": [
9
+ 1577,
10
+ 192
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 106
15
+ },
16
+ "flags": {},
17
+ "order": 11,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "model",
22
+ "type": "MODEL",
23
+ "link": 446
24
+ }
25
+ ],
26
+ "outputs": [
27
+ {
28
+ "name": "SIGMAS",
29
+ "type": "SIGMAS",
30
+ "links": [
31
+ 429
32
+ ],
33
+ "shape": 3
34
+ }
35
+ ],
36
+ "properties": {
37
+ "Node name for S&R": "BasicScheduler"
38
+ },
39
+ "widgets_values": [
40
+ "karras",
41
+ 25,
42
+ 1
43
+ ]
44
+ },
45
+ {
46
+ "id": 41,
47
+ "type": "KSamplerSelect",
48
+ "pos": [
49
+ 1585,
50
+ 67
51
+ ],
52
+ "size": {
53
+ "0": 315,
54
+ "1": 58
55
+ },
56
+ "flags": {},
57
+ "order": 0,
58
+ "mode": 0,
59
+ "outputs": [
60
+ {
61
+ "name": "SAMPLER",
62
+ "type": "SAMPLER",
63
+ "links": [
64
+ 428
65
+ ],
66
+ "shape": 3
67
+ }
68
+ ],
69
+ "properties": {
70
+ "Node name for S&R": "KSamplerSelect"
71
+ },
72
+ "widgets_values": [
73
+ "dpmpp_2m"
74
+ ]
75
+ },
76
+ {
77
+ "id": 49,
78
+ "type": "SamplerCustomAdvanced",
79
+ "pos": [
80
+ 2077,
81
+ -96
82
+ ],
83
+ "size": [
84
+ 236.8000030517578,
85
+ 106
86
+ ],
87
+ "flags": {},
88
+ "order": 14,
89
+ "mode": 0,
90
+ "inputs": [
91
+ {
92
+ "name": "noise",
93
+ "type": "NOISE",
94
+ "link": 426,
95
+ "slot_index": 0
96
+ },
97
+ {
98
+ "name": "guider",
99
+ "type": "GUIDER",
100
+ "link": 427,
101
+ "slot_index": 1
102
+ },
103
+ {
104
+ "name": "sampler",
105
+ "type": "SAMPLER",
106
+ "link": 428,
107
+ "slot_index": 2
108
+ },
109
+ {
110
+ "name": "sigmas",
111
+ "type": "SIGMAS",
112
+ "link": 429,
113
+ "slot_index": 3
114
+ },
115
+ {
116
+ "name": "latent_image",
117
+ "type": "LATENT",
118
+ "link": 453,
119
+ "slot_index": 4
120
+ }
121
+ ],
122
+ "outputs": [
123
+ {
124
+ "name": "output",
125
+ "type": "LATENT",
126
+ "links": [
127
+ 436
128
+ ],
129
+ "shape": 3,
130
+ "slot_index": 0
131
+ },
132
+ {
133
+ "name": "denoised_output",
134
+ "type": "LATENT",
135
+ "links": null,
136
+ "shape": 3
137
+ }
138
+ ],
139
+ "properties": {
140
+ "Node name for S&R": "SamplerCustomAdvanced"
141
+ }
142
+ },
143
+ {
144
+ "id": 47,
145
+ "type": "InstructPixToPixConditioning",
146
+ "pos": [
147
+ 1229,
148
+ -105
149
+ ],
150
+ "size": [
151
+ 235.1999969482422,
152
+ 86
153
+ ],
154
+ "flags": {},
155
+ "order": 10,
156
+ "mode": 0,
157
+ "inputs": [
158
+ {
159
+ "name": "positive",
160
+ "type": "CONDITIONING",
161
+ "link": 466
162
+ },
163
+ {
164
+ "name": "negative",
165
+ "type": "CONDITIONING",
166
+ "link": 467
167
+ },
168
+ {
169
+ "name": "vae",
170
+ "type": "VAE",
171
+ "link": 434
172
+ },
173
+ {
174
+ "name": "pixels",
175
+ "type": "IMAGE",
176
+ "link": 465
177
+ }
178
+ ],
179
+ "outputs": [
180
+ {
181
+ "name": "positive",
182
+ "type": "CONDITIONING",
183
+ "links": [
184
+ 423
185
+ ],
186
+ "shape": 3,
187
+ "slot_index": 0
188
+ },
189
+ {
190
+ "name": "negative",
191
+ "type": "CONDITIONING",
192
+ "links": [
193
+ 424
194
+ ],
195
+ "shape": 3,
196
+ "slot_index": 1
197
+ },
198
+ {
199
+ "name": "latent",
200
+ "type": "LATENT",
201
+ "links": [
202
+ 452
203
+ ],
204
+ "shape": 3,
205
+ "slot_index": 2
206
+ }
207
+ ],
208
+ "properties": {
209
+ "Node name for S&R": "InstructPixToPixConditioning"
210
+ }
211
+ },
212
+ {
213
+ "id": 8,
214
+ "type": "VAEDecode",
215
+ "pos": [
216
+ 2371,
217
+ -90
218
+ ],
219
+ "size": [
220
+ 140,
221
+ 46
222
+ ],
223
+ "flags": {},
224
+ "order": 15,
225
+ "mode": 0,
226
+ "inputs": [
227
+ {
228
+ "name": "samples",
229
+ "type": "LATENT",
230
+ "link": 436
231
+ },
232
+ {
233
+ "name": "vae",
234
+ "type": "VAE",
235
+ "link": 8
236
+ }
237
+ ],
238
+ "outputs": [
239
+ {
240
+ "name": "IMAGE",
241
+ "type": "IMAGE",
242
+ "links": [
243
+ 462
244
+ ],
245
+ "slot_index": 0
246
+ }
247
+ ],
248
+ "properties": {
249
+ "Node name for S&R": "VAEDecode"
250
+ }
251
+ },
252
+ {
253
+ "id": 48,
254
+ "type": "DualCFGGuider",
255
+ "pos": [
256
+ 1578,
257
+ -126
258
+ ],
259
+ "size": {
260
+ "0": 315,
261
+ "1": 142
262
+ },
263
+ "flags": {},
264
+ "order": 12,
265
+ "mode": 0,
266
+ "inputs": [
267
+ {
268
+ "name": "model",
269
+ "type": "MODEL",
270
+ "link": 445
271
+ },
272
+ {
273
+ "name": "cond1",
274
+ "type": "CONDITIONING",
275
+ "link": 423
276
+ },
277
+ {
278
+ "name": "cond2",
279
+ "type": "CONDITIONING",
280
+ "link": 424
281
+ },
282
+ {
283
+ "name": "negative",
284
+ "type": "CONDITIONING",
285
+ "link": 468
286
+ }
287
+ ],
288
+ "outputs": [
289
+ {
290
+ "name": "GUIDER",
291
+ "type": "GUIDER",
292
+ "links": [
293
+ 427
294
+ ],
295
+ "shape": 3,
296
+ "slot_index": 0
297
+ }
298
+ ],
299
+ "properties": {
300
+ "Node name for S&R": "DualCFGGuider"
301
+ },
302
+ "widgets_values": [
303
+ 5,
304
+ 1.5
305
+ ]
306
+ },
307
+ {
308
+ "id": 42,
309
+ "type": "RandomNoise",
310
+ "pos": [
311
+ 1585,
312
+ -266
313
+ ],
314
+ "size": {
315
+ "0": 315,
316
+ "1": 82
317
+ },
318
+ "flags": {},
319
+ "order": 1,
320
+ "mode": 0,
321
+ "outputs": [
322
+ {
323
+ "name": "NOISE",
324
+ "type": "NOISE",
325
+ "links": [
326
+ 426
327
+ ],
328
+ "shape": 3
329
+ }
330
+ ],
331
+ "properties": {
332
+ "Node name for S&R": "RandomNoise"
333
+ },
334
+ "widgets_values": [
335
+ 1,
336
+ "fixed"
337
+ ]
338
+ },
339
+ {
340
+ "id": 4,
341
+ "type": "CheckpointLoaderSimple",
342
+ "pos": [
343
+ -428,
344
+ 92
345
+ ],
346
+ "size": {
347
+ "0": 442.8365478515625,
348
+ "1": 98
349
+ },
350
+ "flags": {},
351
+ "order": 2,
352
+ "mode": 0,
353
+ "outputs": [
354
+ {
355
+ "name": "MODEL",
356
+ "type": "MODEL",
357
+ "links": [
358
+ 441
359
+ ],
360
+ "slot_index": 0
361
+ },
362
+ {
363
+ "name": "CLIP",
364
+ "type": "CLIP",
365
+ "links": [
366
+ 124,
367
+ 125
368
+ ],
369
+ "slot_index": 1
370
+ },
371
+ {
372
+ "name": "VAE",
373
+ "type": "VAE",
374
+ "links": [
375
+ 8,
376
+ 434
377
+ ],
378
+ "slot_index": 2
379
+ }
380
+ ],
381
+ "properties": {
382
+ "Node name for S&R": "CheckpointLoaderSimple"
383
+ },
384
+ "widgets_values": [
385
+ "cosxl/cosxl_edit.safetensors"
386
+ ]
387
+ },
388
+ {
389
+ "id": 7,
390
+ "type": "CLIPTextEncode",
391
+ "pos": [
392
+ 670,
393
+ 401
394
+ ],
395
+ "size": {
396
+ "0": 425.27801513671875,
397
+ "1": 180.6060791015625
398
+ },
399
+ "flags": {},
400
+ "order": 6,
401
+ "mode": 0,
402
+ "inputs": [
403
+ {
404
+ "name": "clip",
405
+ "type": "CLIP",
406
+ "link": 124
407
+ }
408
+ ],
409
+ "outputs": [
410
+ {
411
+ "name": "CONDITIONING",
412
+ "type": "CONDITIONING",
413
+ "links": [
414
+ 467,
415
+ 468
416
+ ],
417
+ "slot_index": 0
418
+ }
419
+ ],
420
+ "title": "Negative",
421
+ "properties": {
422
+ "Node name for S&R": "CLIPTextEncode"
423
+ },
424
+ "widgets_values": [
425
+ "blurry, lowres, artifacts, malformed, ill, horror"
426
+ ],
427
+ "color": "#322",
428
+ "bgcolor": "#533"
429
+ },
430
+ {
431
+ "id": 54,
432
+ "type": "PreviewImage",
433
+ "pos": [
434
+ 2601,
435
+ -100
436
+ ],
437
+ "size": [
438
+ 1015.8230525053973,
439
+ 1053.0271000534044
440
+ ],
441
+ "flags": {},
442
+ "order": 16,
443
+ "mode": 0,
444
+ "inputs": [
445
+ {
446
+ "name": "images",
447
+ "type": "IMAGE",
448
+ "link": 462
449
+ }
450
+ ],
451
+ "title": "UUC",
452
+ "properties": {
453
+ "Node name for S&R": "PreviewImage"
454
+ }
455
+ },
456
+ {
457
+ "id": 13,
458
+ "type": "LoadImage",
459
+ "pos": [
460
+ -139,
461
+ 354
462
+ ],
463
+ "size": [
464
+ 287.37362662402893,
465
+ 399.65891042937926
466
+ ],
467
+ "flags": {},
468
+ "order": 3,
469
+ "mode": 0,
470
+ "outputs": [
471
+ {
472
+ "name": "IMAGE",
473
+ "type": "IMAGE",
474
+ "links": [
475
+ 464
476
+ ],
477
+ "shape": 3,
478
+ "slot_index": 0
479
+ },
480
+ {
481
+ "name": "MASK",
482
+ "type": "MASK",
483
+ "links": null,
484
+ "shape": 3
485
+ }
486
+ ],
487
+ "properties": {
488
+ "Node name for S&R": "LoadImage"
489
+ },
490
+ "widgets_values": [
491
+ "blonde_1.png",
492
+ "image"
493
+ ]
494
+ },
495
+ {
496
+ "id": 59,
497
+ "type": "ImageScale",
498
+ "pos": [
499
+ 222,
500
+ 351
501
+ ],
502
+ "size": {
503
+ "0": 315,
504
+ "1": 130
505
+ },
506
+ "flags": {},
507
+ "order": 8,
508
+ "mode": 0,
509
+ "inputs": [
510
+ {
511
+ "name": "image",
512
+ "type": "IMAGE",
513
+ "link": 464
514
+ }
515
+ ],
516
+ "outputs": [
517
+ {
518
+ "name": "IMAGE",
519
+ "type": "IMAGE",
520
+ "links": [
521
+ 465
522
+ ],
523
+ "shape": 3,
524
+ "slot_index": 0
525
+ }
526
+ ],
527
+ "properties": {
528
+ "Node name for S&R": "ImageScale"
529
+ },
530
+ "widgets_values": [
531
+ "lanczos",
532
+ 1024,
533
+ 1024,
534
+ "disabled"
535
+ ]
536
+ },
537
+ {
538
+ "id": 6,
539
+ "type": "CLIPTextEncode",
540
+ "pos": [
541
+ 670,
542
+ 45
543
+ ],
544
+ "size": {
545
+ "0": 422.84503173828125,
546
+ "1": 164.31304931640625
547
+ },
548
+ "flags": {},
549
+ "order": 7,
550
+ "mode": 0,
551
+ "inputs": [
552
+ {
553
+ "name": "clip",
554
+ "type": "CLIP",
555
+ "link": 125
556
+ }
557
+ ],
558
+ "outputs": [
559
+ {
560
+ "name": "CONDITIONING",
561
+ "type": "CONDITIONING",
562
+ "links": [
563
+ 466
564
+ ],
565
+ "slot_index": 0
566
+ }
567
+ ],
568
+ "title": "Positive",
569
+ "properties": {
570
+ "Node name for S&R": "CLIPTextEncode"
571
+ },
572
+ "widgets_values": [
573
+ "illustration portrait of a woman"
574
+ ],
575
+ "color": "#232",
576
+ "bgcolor": "#353"
577
+ },
578
+ {
579
+ "id": 51,
580
+ "type": "IPAdapterAdvanced",
581
+ "pos": [
582
+ 745,
583
+ -493
584
+ ],
585
+ "size": {
586
+ "0": 315,
587
+ "1": 278
588
+ },
589
+ "flags": {},
590
+ "order": 9,
591
+ "mode": 0,
592
+ "inputs": [
593
+ {
594
+ "name": "model",
595
+ "type": "MODEL",
596
+ "link": 442
597
+ },
598
+ {
599
+ "name": "ipadapter",
600
+ "type": "IPADAPTER",
601
+ "link": 440,
602
+ "slot_index": 1
603
+ },
604
+ {
605
+ "name": "image",
606
+ "type": "IMAGE",
607
+ "link": 443,
608
+ "slot_index": 2
609
+ },
610
+ {
611
+ "name": "image_negative",
612
+ "type": "IMAGE",
613
+ "link": null
614
+ },
615
+ {
616
+ "name": "attn_mask",
617
+ "type": "MASK",
618
+ "link": null
619
+ },
620
+ {
621
+ "name": "clip_vision",
622
+ "type": "CLIP_VISION",
623
+ "link": null
624
+ }
625
+ ],
626
+ "outputs": [
627
+ {
628
+ "name": "MODEL",
629
+ "type": "MODEL",
630
+ "links": [
631
+ 445,
632
+ 446
633
+ ],
634
+ "shape": 3,
635
+ "slot_index": 0
636
+ }
637
+ ],
638
+ "properties": {
639
+ "Node name for S&R": "IPAdapterAdvanced"
640
+ },
641
+ "widgets_values": [
642
+ 1,
643
+ "style transfer",
644
+ "concat",
645
+ 0,
646
+ 1,
647
+ "V only"
648
+ ]
649
+ },
650
+ {
651
+ "id": 52,
652
+ "type": "IPAdapterUnifiedLoader",
653
+ "pos": [
654
+ 320,
655
+ -578
656
+ ],
657
+ "size": [
658
+ 210,
659
+ 78
660
+ ],
661
+ "flags": {},
662
+ "order": 5,
663
+ "mode": 0,
664
+ "inputs": [
665
+ {
666
+ "name": "model",
667
+ "type": "MODEL",
668
+ "link": 441
669
+ },
670
+ {
671
+ "name": "ipadapter",
672
+ "type": "IPADAPTER",
673
+ "link": null
674
+ }
675
+ ],
676
+ "outputs": [
677
+ {
678
+ "name": "model",
679
+ "type": "MODEL",
680
+ "links": [
681
+ 442
682
+ ],
683
+ "shape": 3,
684
+ "slot_index": 0
685
+ },
686
+ {
687
+ "name": "ipadapter",
688
+ "type": "IPADAPTER",
689
+ "links": [
690
+ 440
691
+ ],
692
+ "shape": 3
693
+ }
694
+ ],
695
+ "properties": {
696
+ "Node name for S&R": "IPAdapterUnifiedLoader"
697
+ },
698
+ "widgets_values": [
699
+ "STANDARD (medium strength)"
700
+ ]
701
+ },
702
+ {
703
+ "id": 53,
704
+ "type": "LoadImage",
705
+ "pos": [
706
+ 288,
707
+ -420
708
+ ],
709
+ "size": [
710
+ 285.08749118025753,
711
+ 393.470875983831
712
+ ],
713
+ "flags": {},
714
+ "order": 4,
715
+ "mode": 0,
716
+ "outputs": [
717
+ {
718
+ "name": "IMAGE",
719
+ "type": "IMAGE",
720
+ "links": [
721
+ 443
722
+ ],
723
+ "shape": 3
724
+ },
725
+ {
726
+ "name": "MASK",
727
+ "type": "MASK",
728
+ "links": null,
729
+ "shape": 3
730
+ }
731
+ ],
732
+ "properties": {
733
+ "Node name for S&R": "LoadImage"
734
+ },
735
+ "widgets_values": [
736
+ "coloring_landscape.png",
737
+ "image"
738
+ ]
739
+ },
740
+ {
741
+ "id": 58,
742
+ "type": "RepeatLatentBatch",
743
+ "pos": [
744
+ 1572,
745
+ 369
746
+ ],
747
+ "size": {
748
+ "0": 315,
749
+ "1": 58
750
+ },
751
+ "flags": {},
752
+ "order": 13,
753
+ "mode": 0,
754
+ "inputs": [
755
+ {
756
+ "name": "samples",
757
+ "type": "LATENT",
758
+ "link": 452
759
+ }
760
+ ],
761
+ "outputs": [
762
+ {
763
+ "name": "LATENT",
764
+ "type": "LATENT",
765
+ "links": [
766
+ 453
767
+ ],
768
+ "shape": 3,
769
+ "slot_index": 0
770
+ }
771
+ ],
772
+ "properties": {
773
+ "Node name for S&R": "RepeatLatentBatch"
774
+ },
775
+ "widgets_values": [
776
+ 4
777
+ ]
778
+ }
779
+ ],
780
+ "links": [
781
+ [
782
+ 8,
783
+ 4,
784
+ 2,
785
+ 8,
786
+ 1,
787
+ "VAE"
788
+ ],
789
+ [
790
+ 124,
791
+ 4,
792
+ 1,
793
+ 7,
794
+ 0,
795
+ "CLIP"
796
+ ],
797
+ [
798
+ 125,
799
+ 4,
800
+ 1,
801
+ 6,
802
+ 0,
803
+ "CLIP"
804
+ ],
805
+ [
806
+ 423,
807
+ 47,
808
+ 0,
809
+ 48,
810
+ 1,
811
+ "CONDITIONING"
812
+ ],
813
+ [
814
+ 424,
815
+ 47,
816
+ 1,
817
+ 48,
818
+ 2,
819
+ "CONDITIONING"
820
+ ],
821
+ [
822
+ 426,
823
+ 42,
824
+ 0,
825
+ 49,
826
+ 0,
827
+ "NOISE"
828
+ ],
829
+ [
830
+ 427,
831
+ 48,
832
+ 0,
833
+ 49,
834
+ 1,
835
+ "GUIDER"
836
+ ],
837
+ [
838
+ 428,
839
+ 41,
840
+ 0,
841
+ 49,
842
+ 2,
843
+ "SAMPLER"
844
+ ],
845
+ [
846
+ 429,
847
+ 44,
848
+ 0,
849
+ 49,
850
+ 3,
851
+ "SIGMAS"
852
+ ],
853
+ [
854
+ 434,
855
+ 4,
856
+ 2,
857
+ 47,
858
+ 2,
859
+ "VAE"
860
+ ],
861
+ [
862
+ 436,
863
+ 49,
864
+ 0,
865
+ 8,
866
+ 0,
867
+ "LATENT"
868
+ ],
869
+ [
870
+ 440,
871
+ 52,
872
+ 1,
873
+ 51,
874
+ 1,
875
+ "IPADAPTER"
876
+ ],
877
+ [
878
+ 441,
879
+ 4,
880
+ 0,
881
+ 52,
882
+ 0,
883
+ "MODEL"
884
+ ],
885
+ [
886
+ 442,
887
+ 52,
888
+ 0,
889
+ 51,
890
+ 0,
891
+ "MODEL"
892
+ ],
893
+ [
894
+ 443,
895
+ 53,
896
+ 0,
897
+ 51,
898
+ 2,
899
+ "IMAGE"
900
+ ],
901
+ [
902
+ 445,
903
+ 51,
904
+ 0,
905
+ 48,
906
+ 0,
907
+ "MODEL"
908
+ ],
909
+ [
910
+ 446,
911
+ 51,
912
+ 0,
913
+ 44,
914
+ 0,
915
+ "MODEL"
916
+ ],
917
+ [
918
+ 452,
919
+ 47,
920
+ 2,
921
+ 58,
922
+ 0,
923
+ "LATENT"
924
+ ],
925
+ [
926
+ 453,
927
+ 58,
928
+ 0,
929
+ 49,
930
+ 4,
931
+ "LATENT"
932
+ ],
933
+ [
934
+ 462,
935
+ 8,
936
+ 0,
937
+ 54,
938
+ 0,
939
+ "IMAGE"
940
+ ],
941
+ [
942
+ 464,
943
+ 13,
944
+ 0,
945
+ 59,
946
+ 0,
947
+ "IMAGE"
948
+ ],
949
+ [
950
+ 465,
951
+ 59,
952
+ 0,
953
+ 47,
954
+ 3,
955
+ "IMAGE"
956
+ ],
957
+ [
958
+ 466,
959
+ 6,
960
+ 0,
961
+ 47,
962
+ 0,
963
+ "CONDITIONING"
964
+ ],
965
+ [
966
+ 467,
967
+ 7,
968
+ 0,
969
+ 47,
970
+ 1,
971
+ "CONDITIONING"
972
+ ],
973
+ [
974
+ 468,
975
+ 7,
976
+ 0,
977
+ 48,
978
+ 3,
979
+ "CONDITIONING"
980
+ ]
981
+ ],
982
+ "groups": [],
983
+ "config": {},
984
+ "extra": {
985
+ "groupNodes": {
986
+ "IP2PSampler": {
987
+ "nodes": [
988
+ {
989
+ "type": "KSamplerSelect",
990
+ "pos": [
991
+ 912,
992
+ 1536
993
+ ],
994
+ "size": {
995
+ "0": 315,
996
+ "1": 58
997
+ },
998
+ "flags": {},
999
+ "order": 6,
1000
+ "mode": 0,
1001
+ "outputs": [
1002
+ {
1003
+ "name": "SAMPLER",
1004
+ "type": "SAMPLER",
1005
+ "links": [],
1006
+ "shape": 3
1007
+ }
1008
+ ],
1009
+ "properties": {
1010
+ "Node name for S&R": "KSamplerSelect"
1011
+ },
1012
+ "widgets_values": [
1013
+ "euler"
1014
+ ],
1015
+ "index": 0
1016
+ },
1017
+ {
1018
+ "type": "RandomNoise",
1019
+ "pos": [
1020
+ 912,
1021
+ 1200
1022
+ ],
1023
+ "size": {
1024
+ "0": 315,
1025
+ "1": 82
1026
+ },
1027
+ "flags": {},
1028
+ "order": 7,
1029
+ "mode": 0,
1030
+ "outputs": [
1031
+ {
1032
+ "name": "NOISE",
1033
+ "type": "NOISE",
1034
+ "links": [],
1035
+ "shape": 3
1036
+ }
1037
+ ],
1038
+ "properties": {
1039
+ "Node name for S&R": "RandomNoise"
1040
+ },
1041
+ "widgets_values": [
1042
+ 156680208700303,
1043
+ "fixed"
1044
+ ],
1045
+ "index": 1
1046
+ },
1047
+ {
1048
+ "type": "Reroute",
1049
+ "pos": [
1050
+ 720,
1051
+ 1488
1052
+ ],
1053
+ "size": [
1054
+ 75,
1055
+ 26
1056
+ ],
1057
+ "flags": {},
1058
+ "order": 9,
1059
+ "mode": 0,
1060
+ "inputs": [
1061
+ {
1062
+ "name": "",
1063
+ "type": "*",
1064
+ "link": null
1065
+ }
1066
+ ],
1067
+ "outputs": [
1068
+ {
1069
+ "name": "",
1070
+ "type": "*",
1071
+ "links": null
1072
+ }
1073
+ ],
1074
+ "properties": {
1075
+ "showOutputText": false,
1076
+ "horizontal": false
1077
+ },
1078
+ "index": 2
1079
+ },
1080
+ {
1081
+ "type": "BasicScheduler",
1082
+ "pos": [
1083
+ 912,
1084
+ 1632
1085
+ ],
1086
+ "size": {
1087
+ "0": 315,
1088
+ "1": 106
1089
+ },
1090
+ "flags": {},
1091
+ "order": 12,
1092
+ "mode": 0,
1093
+ "inputs": [
1094
+ {
1095
+ "name": "model",
1096
+ "type": "MODEL",
1097
+ "link": null
1098
+ }
1099
+ ],
1100
+ "outputs": [
1101
+ {
1102
+ "name": "SIGMAS",
1103
+ "type": "SIGMAS",
1104
+ "links": [],
1105
+ "shape": 3
1106
+ }
1107
+ ],
1108
+ "properties": {
1109
+ "Node name for S&R": "BasicScheduler"
1110
+ },
1111
+ "widgets_values": [
1112
+ "normal",
1113
+ 20,
1114
+ 1
1115
+ ],
1116
+ "index": 3
1117
+ },
1118
+ {
1119
+ "type": "Reroute",
1120
+ "pos": [
1121
+ 575,
1122
+ 1344
1123
+ ],
1124
+ "size": [
1125
+ 75,
1126
+ 26
1127
+ ],
1128
+ "flags": {},
1129
+ "order": 14,
1130
+ "mode": 0,
1131
+ "inputs": [
1132
+ {
1133
+ "name": "",
1134
+ "type": "*",
1135
+ "link": null
1136
+ }
1137
+ ],
1138
+ "outputs": [
1139
+ {
1140
+ "name": "",
1141
+ "type": "*",
1142
+ "links": null
1143
+ }
1144
+ ],
1145
+ "properties": {
1146
+ "showOutputText": false,
1147
+ "horizontal": false
1148
+ },
1149
+ "index": 4
1150
+ },
1151
+ {
1152
+ "type": "Reroute",
1153
+ "pos": [
1154
+ 570,
1155
+ 1386
1156
+ ],
1157
+ "size": [
1158
+ 75,
1159
+ 26
1160
+ ],
1161
+ "flags": {},
1162
+ "order": 13,
1163
+ "mode": 0,
1164
+ "inputs": [
1165
+ {
1166
+ "name": "",
1167
+ "type": "*",
1168
+ "link": null
1169
+ }
1170
+ ],
1171
+ "outputs": [
1172
+ {
1173
+ "name": "",
1174
+ "type": "*",
1175
+ "links": null
1176
+ }
1177
+ ],
1178
+ "properties": {
1179
+ "showOutputText": false,
1180
+ "horizontal": false
1181
+ },
1182
+ "index": 5
1183
+ },
1184
+ {
1185
+ "type": "InstructPixToPixConditioning",
1186
+ "pos": [
1187
+ 672,
1188
+ 1344
1189
+ ],
1190
+ "size": {
1191
+ "0": 235.1999969482422,
1192
+ "1": 86
1193
+ },
1194
+ "flags": {},
1195
+ "order": 15,
1196
+ "mode": 0,
1197
+ "inputs": [
1198
+ {
1199
+ "name": "positive",
1200
+ "type": "CONDITIONING",
1201
+ "link": null
1202
+ },
1203
+ {
1204
+ "name": "negative",
1205
+ "type": "CONDITIONING",
1206
+ "link": null
1207
+ },
1208
+ {
1209
+ "name": "vae",
1210
+ "type": "VAE",
1211
+ "link": null
1212
+ },
1213
+ {
1214
+ "name": "pixels",
1215
+ "type": "IMAGE",
1216
+ "link": null
1217
+ }
1218
+ ],
1219
+ "outputs": [
1220
+ {
1221
+ "name": "positive",
1222
+ "type": "CONDITIONING",
1223
+ "links": [],
1224
+ "shape": 3,
1225
+ "slot_index": 0
1226
+ },
1227
+ {
1228
+ "name": "negative",
1229
+ "type": "CONDITIONING",
1230
+ "links": [],
1231
+ "shape": 3,
1232
+ "slot_index": 1
1233
+ },
1234
+ {
1235
+ "name": "latent",
1236
+ "type": "LATENT",
1237
+ "links": [],
1238
+ "shape": 3,
1239
+ "slot_index": 2
1240
+ }
1241
+ ],
1242
+ "properties": {
1243
+ "Node name for S&R": "InstructPixToPixConditioning"
1244
+ },
1245
+ "index": 6
1246
+ },
1247
+ {
1248
+ "type": "DualCFGGuider",
1249
+ "pos": [
1250
+ 912,
1251
+ 1344
1252
+ ],
1253
+ "size": {
1254
+ "0": 315,
1255
+ "1": 142
1256
+ },
1257
+ "flags": {},
1258
+ "order": 16,
1259
+ "mode": 0,
1260
+ "inputs": [
1261
+ {
1262
+ "name": "model",
1263
+ "type": "MODEL",
1264
+ "link": null
1265
+ },
1266
+ {
1267
+ "name": "cond1",
1268
+ "type": "CONDITIONING",
1269
+ "link": null
1270
+ },
1271
+ {
1272
+ "name": "cond2",
1273
+ "type": "CONDITIONING",
1274
+ "link": null
1275
+ },
1276
+ {
1277
+ "name": "negative",
1278
+ "type": "CONDITIONING",
1279
+ "link": null
1280
+ }
1281
+ ],
1282
+ "outputs": [
1283
+ {
1284
+ "name": "GUIDER",
1285
+ "type": "GUIDER",
1286
+ "links": [],
1287
+ "shape": 3,
1288
+ "slot_index": 0
1289
+ }
1290
+ ],
1291
+ "properties": {
1292
+ "Node name for S&R": "DualCFGGuider"
1293
+ },
1294
+ "widgets_values": [
1295
+ 3,
1296
+ 1.5
1297
+ ],
1298
+ "index": 7
1299
+ },
1300
+ {
1301
+ "type": "SamplerCustomAdvanced",
1302
+ "pos": [
1303
+ 1296,
1304
+ 1200
1305
+ ],
1306
+ "size": {
1307
+ "0": 355.20001220703125,
1308
+ "1": 106
1309
+ },
1310
+ "flags": {},
1311
+ "order": 17,
1312
+ "mode": 0,
1313
+ "inputs": [
1314
+ {
1315
+ "name": "noise",
1316
+ "type": "NOISE",
1317
+ "link": null,
1318
+ "slot_index": 0
1319
+ },
1320
+ {
1321
+ "name": "guider",
1322
+ "type": "GUIDER",
1323
+ "link": null,
1324
+ "slot_index": 1
1325
+ },
1326
+ {
1327
+ "name": "sampler",
1328
+ "type": "SAMPLER",
1329
+ "link": null,
1330
+ "slot_index": 2
1331
+ },
1332
+ {
1333
+ "name": "sigmas",
1334
+ "type": "SIGMAS",
1335
+ "link": null,
1336
+ "slot_index": 3
1337
+ },
1338
+ {
1339
+ "name": "latent_image",
1340
+ "type": "LATENT",
1341
+ "link": null,
1342
+ "slot_index": 4
1343
+ }
1344
+ ],
1345
+ "outputs": [
1346
+ {
1347
+ "name": "output",
1348
+ "type": "LATENT",
1349
+ "links": [],
1350
+ "shape": 3,
1351
+ "slot_index": 0
1352
+ },
1353
+ {
1354
+ "name": "denoised_output",
1355
+ "type": "LATENT",
1356
+ "links": null,
1357
+ "shape": 3
1358
+ }
1359
+ ],
1360
+ "properties": {
1361
+ "Node name for S&R": "SamplerCustomAdvanced"
1362
+ },
1363
+ "index": 8
1364
+ }
1365
+ ],
1366
+ "links": [
1367
+ [
1368
+ null,
1369
+ 0,
1370
+ 2,
1371
+ 0,
1372
+ 4,
1373
+ "MODEL"
1374
+ ],
1375
+ [
1376
+ 2,
1377
+ 0,
1378
+ 3,
1379
+ 0,
1380
+ 26,
1381
+ "MODEL"
1382
+ ],
1383
+ [
1384
+ null,
1385
+ 0,
1386
+ 5,
1387
+ 0,
1388
+ 7,
1389
+ "CONDITIONING"
1390
+ ],
1391
+ [
1392
+ null,
1393
+ 0,
1394
+ 4,
1395
+ 0,
1396
+ 6,
1397
+ "CONDITIONING"
1398
+ ],
1399
+ [
1400
+ 4,
1401
+ 0,
1402
+ 6,
1403
+ 0,
1404
+ 35,
1405
+ "CONDITIONING"
1406
+ ],
1407
+ [
1408
+ 5,
1409
+ 0,
1410
+ 6,
1411
+ 1,
1412
+ 29,
1413
+ "CONDITIONING"
1414
+ ],
1415
+ [
1416
+ null,
1417
+ 2,
1418
+ 6,
1419
+ 2,
1420
+ 4,
1421
+ "VAE"
1422
+ ],
1423
+ [
1424
+ null,
1425
+ 0,
1426
+ 6,
1427
+ 3,
1428
+ 13,
1429
+ "IMAGE"
1430
+ ],
1431
+ [
1432
+ 2,
1433
+ 0,
1434
+ 7,
1435
+ 0,
1436
+ 26,
1437
+ "MODEL"
1438
+ ],
1439
+ [
1440
+ 6,
1441
+ 0,
1442
+ 7,
1443
+ 1,
1444
+ 33,
1445
+ "CONDITIONING"
1446
+ ],
1447
+ [
1448
+ 6,
1449
+ 1,
1450
+ 7,
1451
+ 2,
1452
+ 33,
1453
+ "CONDITIONING"
1454
+ ],
1455
+ [
1456
+ 5,
1457
+ 0,
1458
+ 7,
1459
+ 3,
1460
+ 29,
1461
+ "CONDITIONING"
1462
+ ],
1463
+ [
1464
+ 1,
1465
+ 0,
1466
+ 8,
1467
+ 0,
1468
+ 19,
1469
+ "NOISE"
1470
+ ],
1471
+ [
1472
+ 7,
1473
+ 0,
1474
+ 8,
1475
+ 1,
1476
+ 28,
1477
+ "GUIDER"
1478
+ ],
1479
+ [
1480
+ 0,
1481
+ 0,
1482
+ 8,
1483
+ 2,
1484
+ 20,
1485
+ "SAMPLER"
1486
+ ],
1487
+ [
1488
+ 3,
1489
+ 0,
1490
+ 8,
1491
+ 3,
1492
+ 21,
1493
+ "SIGMAS"
1494
+ ],
1495
+ [
1496
+ 6,
1497
+ 2,
1498
+ 8,
1499
+ 4,
1500
+ 33,
1501
+ "LATENT"
1502
+ ]
1503
+ ],
1504
+ "external": [
1505
+ [
1506
+ {
1507
+ "type": "SamplerCustomAdvanced",
1508
+ "pos": [
1509
+ 1296,
1510
+ 1200
1511
+ ],
1512
+ "size": {
1513
+ "0": 355.20001220703125,
1514
+ "1": 106
1515
+ },
1516
+ "flags": {},
1517
+ "order": 17,
1518
+ "mode": 0,
1519
+ "inputs": [
1520
+ {
1521
+ "name": "noise",
1522
+ "type": "NOISE",
1523
+ "link": null,
1524
+ "slot_index": 0
1525
+ },
1526
+ {
1527
+ "name": "guider",
1528
+ "type": "GUIDER",
1529
+ "link": null,
1530
+ "slot_index": 1
1531
+ },
1532
+ {
1533
+ "name": "sampler",
1534
+ "type": "SAMPLER",
1535
+ "link": null,
1536
+ "slot_index": 2
1537
+ },
1538
+ {
1539
+ "name": "sigmas",
1540
+ "type": "SIGMAS",
1541
+ "link": null,
1542
+ "slot_index": 3
1543
+ },
1544
+ {
1545
+ "name": "latent_image",
1546
+ "type": "LATENT",
1547
+ "link": null,
1548
+ "slot_index": 4
1549
+ }
1550
+ ],
1551
+ "outputs": [
1552
+ {
1553
+ "name": "output",
1554
+ "type": "LATENT",
1555
+ "links": [],
1556
+ "shape": 3,
1557
+ "slot_index": 0
1558
+ },
1559
+ {
1560
+ "name": "denoised_output",
1561
+ "type": "LATENT",
1562
+ "links": null,
1563
+ "shape": 3
1564
+ }
1565
+ ],
1566
+ "properties": {
1567
+ "Node name for S&R": "SamplerCustomAdvanced"
1568
+ },
1569
+ "index": 8
1570
+ },
1571
+ 0,
1572
+ "LATENT"
1573
+ ]
1574
+ ],
1575
+ "config": {
1576
+ "0": {},
1577
+ "1": {},
1578
+ "2": {
1579
+ "input": {
1580
+ "MODEL": {
1581
+ "name": "model"
1582
+ }
1583
+ }
1584
+ },
1585
+ "3": {},
1586
+ "4": {
1587
+ "input": {
1588
+ "CONDITIONING": {
1589
+ "name": "positive"
1590
+ }
1591
+ }
1592
+ },
1593
+ "5": {
1594
+ "input": {
1595
+ "CONDITIONING": {
1596
+ "name": "negative"
1597
+ }
1598
+ }
1599
+ },
1600
+ "6": {},
1601
+ "7": {
1602
+ "input": {
1603
+ "cfg_conds": {
1604
+ "name": "cfg_text"
1605
+ },
1606
+ "cfg_cond2_negative": {
1607
+ "name": "cfg_image"
1608
+ }
1609
+ }
1610
+ },
1611
+ "8": {}
1612
+ }
1613
+ }
1614
+ },
1615
+ "ds": {
1616
+ "scale": 0.45949729863579125,
1617
+ "offset": [
1618
+ 197.43602825302307,
1619
+ 1634.0791215485065
1620
+ ]
1621
+ }
1622
+ },
1623
+ "version": 0.4
1624
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_faceid.json ADDED
@@ -0,0 +1,566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 20,
3
+ "last_link_id": 36,
4
+ "nodes": [
5
+ {
6
+ "id": 8,
7
+ "type": "VAEDecode",
8
+ "pos": [
9
+ 1640,
10
+ 710
11
+ ],
12
+ "size": {
13
+ "0": 140,
14
+ "1": 46
15
+ },
16
+ "flags": {},
17
+ "order": 8,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "samples",
22
+ "type": "LATENT",
23
+ "link": 7
24
+ },
25
+ {
26
+ "name": "vae",
27
+ "type": "VAE",
28
+ "link": 8
29
+ }
30
+ ],
31
+ "outputs": [
32
+ {
33
+ "name": "IMAGE",
34
+ "type": "IMAGE",
35
+ "links": [
36
+ 9
37
+ ],
38
+ "slot_index": 0
39
+ }
40
+ ],
41
+ "properties": {
42
+ "Node name for S&R": "VAEDecode"
43
+ }
44
+ },
45
+ {
46
+ "id": 5,
47
+ "type": "EmptyLatentImage",
48
+ "pos": [
49
+ 870,
50
+ 1100
51
+ ],
52
+ "size": {
53
+ "0": 315,
54
+ "1": 106
55
+ },
56
+ "flags": {},
57
+ "order": 0,
58
+ "mode": 0,
59
+ "outputs": [
60
+ {
61
+ "name": "LATENT",
62
+ "type": "LATENT",
63
+ "links": [
64
+ 2
65
+ ],
66
+ "slot_index": 0
67
+ }
68
+ ],
69
+ "properties": {
70
+ "Node name for S&R": "EmptyLatentImage"
71
+ },
72
+ "widgets_values": [
73
+ 512,
74
+ 512,
75
+ 1
76
+ ]
77
+ },
78
+ {
79
+ "id": 3,
80
+ "type": "KSampler",
81
+ "pos": [
82
+ 1280,
83
+ 710
84
+ ],
85
+ "size": {
86
+ "0": 315,
87
+ "1": 262
88
+ },
89
+ "flags": {},
90
+ "order": 7,
91
+ "mode": 0,
92
+ "inputs": [
93
+ {
94
+ "name": "model",
95
+ "type": "MODEL",
96
+ "link": 32
97
+ },
98
+ {
99
+ "name": "positive",
100
+ "type": "CONDITIONING",
101
+ "link": 4
102
+ },
103
+ {
104
+ "name": "negative",
105
+ "type": "CONDITIONING",
106
+ "link": 6
107
+ },
108
+ {
109
+ "name": "latent_image",
110
+ "type": "LATENT",
111
+ "link": 2
112
+ }
113
+ ],
114
+ "outputs": [
115
+ {
116
+ "name": "LATENT",
117
+ "type": "LATENT",
118
+ "links": [
119
+ 7
120
+ ],
121
+ "slot_index": 0
122
+ }
123
+ ],
124
+ "properties": {
125
+ "Node name for S&R": "KSampler"
126
+ },
127
+ "widgets_values": [
128
+ 0,
129
+ "fixed",
130
+ 30,
131
+ 6.5,
132
+ "ddpm",
133
+ "karras",
134
+ 1
135
+ ]
136
+ },
137
+ {
138
+ "id": 9,
139
+ "type": "SaveImage",
140
+ "pos": [
141
+ 1830,
142
+ 700
143
+ ],
144
+ "size": {
145
+ "0": 529.7760009765625,
146
+ "1": 582.3048095703125
147
+ },
148
+ "flags": {},
149
+ "order": 9,
150
+ "mode": 0,
151
+ "inputs": [
152
+ {
153
+ "name": "images",
154
+ "type": "IMAGE",
155
+ "link": 9
156
+ }
157
+ ],
158
+ "properties": {},
159
+ "widgets_values": [
160
+ "IPAdapter"
161
+ ]
162
+ },
163
+ {
164
+ "id": 12,
165
+ "type": "LoadImage",
166
+ "pos": [
167
+ 450,
168
+ 240
169
+ ],
170
+ "size": {
171
+ "0": 315,
172
+ "1": 314
173
+ },
174
+ "flags": {},
175
+ "order": 1,
176
+ "mode": 0,
177
+ "outputs": [
178
+ {
179
+ "name": "IMAGE",
180
+ "type": "IMAGE",
181
+ "links": [
182
+ 29
183
+ ],
184
+ "shape": 3,
185
+ "slot_index": 0
186
+ },
187
+ {
188
+ "name": "MASK",
189
+ "type": "MASK",
190
+ "links": null,
191
+ "shape": 3
192
+ }
193
+ ],
194
+ "properties": {
195
+ "Node name for S&R": "LoadImage"
196
+ },
197
+ "widgets_values": [
198
+ "rosario_4.jpg",
199
+ "image"
200
+ ]
201
+ },
202
+ {
203
+ "id": 20,
204
+ "type": "IPAdapterUnifiedLoaderFaceID",
205
+ "pos": [
206
+ 460,
207
+ 60
208
+ ],
209
+ "size": {
210
+ "0": 315,
211
+ "1": 126
212
+ },
213
+ "flags": {},
214
+ "order": 3,
215
+ "mode": 0,
216
+ "inputs": [
217
+ {
218
+ "name": "model",
219
+ "type": "MODEL",
220
+ "link": 36
221
+ },
222
+ {
223
+ "name": "ipadapter",
224
+ "type": "IPADAPTER",
225
+ "link": null
226
+ }
227
+ ],
228
+ "outputs": [
229
+ {
230
+ "name": "MODEL",
231
+ "type": "MODEL",
232
+ "links": [
233
+ 35
234
+ ],
235
+ "shape": 3,
236
+ "slot_index": 0
237
+ },
238
+ {
239
+ "name": "ipadapter",
240
+ "type": "IPADAPTER",
241
+ "links": [
242
+ 34
243
+ ],
244
+ "shape": 3
245
+ }
246
+ ],
247
+ "properties": {
248
+ "Node name for S&R": "IPAdapterUnifiedLoaderFaceID"
249
+ },
250
+ "widgets_values": [
251
+ "FACEID PLUS V2",
252
+ 0.6,
253
+ "CPU"
254
+ ]
255
+ },
256
+ {
257
+ "id": 7,
258
+ "type": "CLIPTextEncode",
259
+ "pos": [
260
+ 760,
261
+ 850
262
+ ],
263
+ "size": {
264
+ "0": 425.27801513671875,
265
+ "1": 180.6060791015625
266
+ },
267
+ "flags": {},
268
+ "order": 5,
269
+ "mode": 0,
270
+ "inputs": [
271
+ {
272
+ "name": "clip",
273
+ "type": "CLIP",
274
+ "link": 5
275
+ }
276
+ ],
277
+ "outputs": [
278
+ {
279
+ "name": "CONDITIONING",
280
+ "type": "CONDITIONING",
281
+ "links": [
282
+ 6
283
+ ],
284
+ "slot_index": 0
285
+ }
286
+ ],
287
+ "properties": {
288
+ "Node name for S&R": "CLIPTextEncode"
289
+ },
290
+ "widgets_values": [
291
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed, naked"
292
+ ]
293
+ },
294
+ {
295
+ "id": 6,
296
+ "type": "CLIPTextEncode",
297
+ "pos": [
298
+ 760,
299
+ 620
300
+ ],
301
+ "size": {
302
+ "0": 422.84503173828125,
303
+ "1": 164.31304931640625
304
+ },
305
+ "flags": {},
306
+ "order": 4,
307
+ "mode": 0,
308
+ "inputs": [
309
+ {
310
+ "name": "clip",
311
+ "type": "CLIP",
312
+ "link": 3
313
+ }
314
+ ],
315
+ "outputs": [
316
+ {
317
+ "name": "CONDITIONING",
318
+ "type": "CONDITIONING",
319
+ "links": [
320
+ 4
321
+ ],
322
+ "slot_index": 0
323
+ }
324
+ ],
325
+ "properties": {
326
+ "Node name for S&R": "CLIPTextEncode"
327
+ },
328
+ "widgets_values": [
329
+ "closeup of a beautiful woman wearing a black dress on the seaside\n\nserene, sunset, spring, high quality, detailed, diffuse light"
330
+ ]
331
+ },
332
+ {
333
+ "id": 4,
334
+ "type": "CheckpointLoaderSimple",
335
+ "pos": [
336
+ 10,
337
+ 680
338
+ ],
339
+ "size": {
340
+ "0": 315,
341
+ "1": 98
342
+ },
343
+ "flags": {},
344
+ "order": 2,
345
+ "mode": 0,
346
+ "outputs": [
347
+ {
348
+ "name": "MODEL",
349
+ "type": "MODEL",
350
+ "links": [
351
+ 36
352
+ ],
353
+ "slot_index": 0
354
+ },
355
+ {
356
+ "name": "CLIP",
357
+ "type": "CLIP",
358
+ "links": [
359
+ 3,
360
+ 5
361
+ ],
362
+ "slot_index": 1
363
+ },
364
+ {
365
+ "name": "VAE",
366
+ "type": "VAE",
367
+ "links": [
368
+ 8
369
+ ],
370
+ "slot_index": 2
371
+ }
372
+ ],
373
+ "properties": {
374
+ "Node name for S&R": "CheckpointLoaderSimple"
375
+ },
376
+ "widgets_values": [
377
+ "sd15/realisticVisionV51_v51VAE.safetensors"
378
+ ]
379
+ },
380
+ {
381
+ "id": 18,
382
+ "type": "IPAdapterFaceID",
383
+ "pos": [
384
+ 850,
385
+ 190
386
+ ],
387
+ "size": {
388
+ "0": 315,
389
+ "1": 298
390
+ },
391
+ "flags": {},
392
+ "order": 6,
393
+ "mode": 0,
394
+ "inputs": [
395
+ {
396
+ "name": "model",
397
+ "type": "MODEL",
398
+ "link": 35
399
+ },
400
+ {
401
+ "name": "ipadapter",
402
+ "type": "IPADAPTER",
403
+ "link": 34,
404
+ "slot_index": 1
405
+ },
406
+ {
407
+ "name": "image",
408
+ "type": "IMAGE",
409
+ "link": 29
410
+ },
411
+ {
412
+ "name": "image_negative",
413
+ "type": "IMAGE",
414
+ "link": null
415
+ },
416
+ {
417
+ "name": "attn_mask",
418
+ "type": "MASK",
419
+ "link": null
420
+ },
421
+ {
422
+ "name": "clip_vision",
423
+ "type": "CLIP_VISION",
424
+ "link": null
425
+ },
426
+ {
427
+ "name": "insightface",
428
+ "type": "INSIGHTFACE",
429
+ "link": null
430
+ }
431
+ ],
432
+ "outputs": [
433
+ {
434
+ "name": "MODEL",
435
+ "type": "MODEL",
436
+ "links": [
437
+ 32
438
+ ],
439
+ "shape": 3,
440
+ "slot_index": 0
441
+ }
442
+ ],
443
+ "properties": {
444
+ "Node name for S&R": "IPAdapterFaceID"
445
+ },
446
+ "widgets_values": [
447
+ 1,
448
+ 2,
449
+ "linear",
450
+ "concat",
451
+ 0,
452
+ 1
453
+ ]
454
+ }
455
+ ],
456
+ "links": [
457
+ [
458
+ 2,
459
+ 5,
460
+ 0,
461
+ 3,
462
+ 3,
463
+ "LATENT"
464
+ ],
465
+ [
466
+ 3,
467
+ 4,
468
+ 1,
469
+ 6,
470
+ 0,
471
+ "CLIP"
472
+ ],
473
+ [
474
+ 4,
475
+ 6,
476
+ 0,
477
+ 3,
478
+ 1,
479
+ "CONDITIONING"
480
+ ],
481
+ [
482
+ 5,
483
+ 4,
484
+ 1,
485
+ 7,
486
+ 0,
487
+ "CLIP"
488
+ ],
489
+ [
490
+ 6,
491
+ 7,
492
+ 0,
493
+ 3,
494
+ 2,
495
+ "CONDITIONING"
496
+ ],
497
+ [
498
+ 7,
499
+ 3,
500
+ 0,
501
+ 8,
502
+ 0,
503
+ "LATENT"
504
+ ],
505
+ [
506
+ 8,
507
+ 4,
508
+ 2,
509
+ 8,
510
+ 1,
511
+ "VAE"
512
+ ],
513
+ [
514
+ 9,
515
+ 8,
516
+ 0,
517
+ 9,
518
+ 0,
519
+ "IMAGE"
520
+ ],
521
+ [
522
+ 29,
523
+ 12,
524
+ 0,
525
+ 18,
526
+ 2,
527
+ "IMAGE"
528
+ ],
529
+ [
530
+ 32,
531
+ 18,
532
+ 0,
533
+ 3,
534
+ 0,
535
+ "MODEL"
536
+ ],
537
+ [
538
+ 34,
539
+ 20,
540
+ 1,
541
+ 18,
542
+ 1,
543
+ "IPADAPTER"
544
+ ],
545
+ [
546
+ 35,
547
+ 20,
548
+ 0,
549
+ 18,
550
+ 0,
551
+ "MODEL"
552
+ ],
553
+ [
554
+ 36,
555
+ 4,
556
+ 0,
557
+ 20,
558
+ 0,
559
+ "MODEL"
560
+ ]
561
+ ],
562
+ "groups": [],
563
+ "config": {},
564
+ "extra": {},
565
+ "version": 0.4
566
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_faceid_batch.json ADDED
@@ -0,0 +1,1023 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 33,
3
+ "last_link_id": 56,
4
+ "nodes": [
5
+ {
6
+ "id": 5,
7
+ "type": "EmptyLatentImage",
8
+ "pos": [
9
+ 870,
10
+ 1100
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 106
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "LATENT",
22
+ "type": "LATENT",
23
+ "links": [
24
+ 2
25
+ ],
26
+ "slot_index": 0
27
+ }
28
+ ],
29
+ "properties": {
30
+ "Node name for S&R": "EmptyLatentImage"
31
+ },
32
+ "widgets_values": [
33
+ 512,
34
+ 512,
35
+ 1
36
+ ]
37
+ },
38
+ {
39
+ "id": 3,
40
+ "type": "KSampler",
41
+ "pos": [
42
+ 1280,
43
+ 710
44
+ ],
45
+ "size": {
46
+ "0": 315,
47
+ "1": 262
48
+ },
49
+ "flags": {},
50
+ "order": 15,
51
+ "mode": 0,
52
+ "inputs": [
53
+ {
54
+ "name": "model",
55
+ "type": "MODEL",
56
+ "link": 42
57
+ },
58
+ {
59
+ "name": "positive",
60
+ "type": "CONDITIONING",
61
+ "link": 4
62
+ },
63
+ {
64
+ "name": "negative",
65
+ "type": "CONDITIONING",
66
+ "link": 6
67
+ },
68
+ {
69
+ "name": "latent_image",
70
+ "type": "LATENT",
71
+ "link": 2
72
+ }
73
+ ],
74
+ "outputs": [
75
+ {
76
+ "name": "LATENT",
77
+ "type": "LATENT",
78
+ "links": [
79
+ 7
80
+ ],
81
+ "slot_index": 0
82
+ }
83
+ ],
84
+ "properties": {
85
+ "Node name for S&R": "KSampler"
86
+ },
87
+ "widgets_values": [
88
+ 0,
89
+ "fixed",
90
+ 30,
91
+ 6.5,
92
+ "ddpm",
93
+ "karras",
94
+ 1
95
+ ]
96
+ },
97
+ {
98
+ "id": 7,
99
+ "type": "CLIPTextEncode",
100
+ "pos": [
101
+ 760,
102
+ 850
103
+ ],
104
+ "size": {
105
+ "0": 425.27801513671875,
106
+ "1": 180.6060791015625
107
+ },
108
+ "flags": {},
109
+ "order": 10,
110
+ "mode": 0,
111
+ "inputs": [
112
+ {
113
+ "name": "clip",
114
+ "type": "CLIP",
115
+ "link": 5
116
+ }
117
+ ],
118
+ "outputs": [
119
+ {
120
+ "name": "CONDITIONING",
121
+ "type": "CONDITIONING",
122
+ "links": [
123
+ 6
124
+ ],
125
+ "slot_index": 0
126
+ }
127
+ ],
128
+ "properties": {
129
+ "Node name for S&R": "CLIPTextEncode"
130
+ },
131
+ "widgets_values": [
132
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed, naked"
133
+ ]
134
+ },
135
+ {
136
+ "id": 6,
137
+ "type": "CLIPTextEncode",
138
+ "pos": [
139
+ 760,
140
+ 620
141
+ ],
142
+ "size": {
143
+ "0": 422.84503173828125,
144
+ "1": 164.31304931640625
145
+ },
146
+ "flags": {},
147
+ "order": 9,
148
+ "mode": 0,
149
+ "inputs": [
150
+ {
151
+ "name": "clip",
152
+ "type": "CLIP",
153
+ "link": 3
154
+ }
155
+ ],
156
+ "outputs": [
157
+ {
158
+ "name": "CONDITIONING",
159
+ "type": "CONDITIONING",
160
+ "links": [
161
+ 4
162
+ ],
163
+ "slot_index": 0
164
+ }
165
+ ],
166
+ "properties": {
167
+ "Node name for S&R": "CLIPTextEncode"
168
+ },
169
+ "widgets_values": [
170
+ "closeup of a beautiful woman wearing a black dress on the seaside\n\nserene, sunset, spring, high quality, detailed, diffuse light"
171
+ ]
172
+ },
173
+ {
174
+ "id": 22,
175
+ "type": "IPAdapterUnifiedLoader",
176
+ "pos": [
177
+ 855,
178
+ 51
179
+ ],
180
+ "size": {
181
+ "0": 315,
182
+ "1": 78
183
+ },
184
+ "flags": {},
185
+ "order": 13,
186
+ "mode": 0,
187
+ "inputs": [
188
+ {
189
+ "name": "model",
190
+ "type": "MODEL",
191
+ "link": 43
192
+ },
193
+ {
194
+ "name": "ipadapter",
195
+ "type": "IPADAPTER",
196
+ "link": 38
197
+ }
198
+ ],
199
+ "outputs": [
200
+ {
201
+ "name": "model",
202
+ "type": "MODEL",
203
+ "links": [
204
+ 40
205
+ ],
206
+ "shape": 3,
207
+ "slot_index": 0
208
+ },
209
+ {
210
+ "name": "ipadapter",
211
+ "type": "IPADAPTER",
212
+ "links": [
213
+ 37
214
+ ],
215
+ "shape": 3
216
+ }
217
+ ],
218
+ "properties": {
219
+ "Node name for S&R": "IPAdapterUnifiedLoader"
220
+ },
221
+ "widgets_values": [
222
+ "FULL FACE - SD1.5 only (portraits stronger)"
223
+ ]
224
+ },
225
+ {
226
+ "id": 21,
227
+ "type": "IPAdapter",
228
+ "pos": [
229
+ 1280,
230
+ 170
231
+ ],
232
+ "size": {
233
+ "0": 315,
234
+ "1": 190
235
+ },
236
+ "flags": {},
237
+ "order": 14,
238
+ "mode": 0,
239
+ "inputs": [
240
+ {
241
+ "name": "model",
242
+ "type": "MODEL",
243
+ "link": 40
244
+ },
245
+ {
246
+ "name": "ipadapter",
247
+ "type": "IPADAPTER",
248
+ "link": 37,
249
+ "slot_index": 1
250
+ },
251
+ {
252
+ "name": "image",
253
+ "type": "IMAGE",
254
+ "link": 56
255
+ },
256
+ {
257
+ "name": "attn_mask",
258
+ "type": "MASK",
259
+ "link": null
260
+ }
261
+ ],
262
+ "outputs": [
263
+ {
264
+ "name": "MODEL",
265
+ "type": "MODEL",
266
+ "links": [
267
+ 42
268
+ ],
269
+ "shape": 3,
270
+ "slot_index": 0
271
+ }
272
+ ],
273
+ "properties": {
274
+ "Node name for S&R": "IPAdapter"
275
+ },
276
+ "widgets_values": [
277
+ 0.4,
278
+ 0,
279
+ 1,
280
+ "standard"
281
+ ]
282
+ },
283
+ {
284
+ "id": 20,
285
+ "type": "IPAdapterUnifiedLoaderFaceID",
286
+ "pos": [
287
+ 457,
288
+ 57
289
+ ],
290
+ "size": {
291
+ "0": 315,
292
+ "1": 126
293
+ },
294
+ "flags": {},
295
+ "order": 8,
296
+ "mode": 0,
297
+ "inputs": [
298
+ {
299
+ "name": "model",
300
+ "type": "MODEL",
301
+ "link": 36
302
+ },
303
+ {
304
+ "name": "ipadapter",
305
+ "type": "IPADAPTER",
306
+ "link": null
307
+ }
308
+ ],
309
+ "outputs": [
310
+ {
311
+ "name": "MODEL",
312
+ "type": "MODEL",
313
+ "links": [
314
+ 35
315
+ ],
316
+ "shape": 3,
317
+ "slot_index": 0
318
+ },
319
+ {
320
+ "name": "ipadapter",
321
+ "type": "IPADAPTER",
322
+ "links": [
323
+ 34,
324
+ 38
325
+ ],
326
+ "shape": 3,
327
+ "slot_index": 1
328
+ }
329
+ ],
330
+ "properties": {
331
+ "Node name for S&R": "IPAdapterUnifiedLoaderFaceID"
332
+ },
333
+ "widgets_values": [
334
+ "FACEID PLUS V2",
335
+ 0.6,
336
+ "CPU"
337
+ ]
338
+ },
339
+ {
340
+ "id": 27,
341
+ "type": "ImageBatch",
342
+ "pos": [
343
+ 180,
344
+ -210
345
+ ],
346
+ "size": {
347
+ "0": 210,
348
+ "1": 46
349
+ },
350
+ "flags": {},
351
+ "order": 6,
352
+ "mode": 0,
353
+ "inputs": [
354
+ {
355
+ "name": "image1",
356
+ "type": "IMAGE",
357
+ "link": 44
358
+ },
359
+ {
360
+ "name": "image2",
361
+ "type": "IMAGE",
362
+ "link": 45
363
+ }
364
+ ],
365
+ "outputs": [
366
+ {
367
+ "name": "IMAGE",
368
+ "type": "IMAGE",
369
+ "links": [
370
+ 48
371
+ ],
372
+ "shape": 3,
373
+ "slot_index": 0
374
+ }
375
+ ],
376
+ "properties": {
377
+ "Node name for S&R": "ImageBatch"
378
+ }
379
+ },
380
+ {
381
+ "id": 28,
382
+ "type": "ImageBatch",
383
+ "pos": [
384
+ 180,
385
+ -110
386
+ ],
387
+ "size": {
388
+ "0": 210,
389
+ "1": 46
390
+ },
391
+ "flags": {},
392
+ "order": 7,
393
+ "mode": 0,
394
+ "inputs": [
395
+ {
396
+ "name": "image1",
397
+ "type": "IMAGE",
398
+ "link": 46
399
+ },
400
+ {
401
+ "name": "image2",
402
+ "type": "IMAGE",
403
+ "link": 47
404
+ }
405
+ ],
406
+ "outputs": [
407
+ {
408
+ "name": "IMAGE",
409
+ "type": "IMAGE",
410
+ "links": [
411
+ 49
412
+ ],
413
+ "shape": 3,
414
+ "slot_index": 0
415
+ }
416
+ ],
417
+ "properties": {
418
+ "Node name for S&R": "ImageBatch"
419
+ }
420
+ },
421
+ {
422
+ "id": 29,
423
+ "type": "ImageBatch",
424
+ "pos": [
425
+ 420,
426
+ -170
427
+ ],
428
+ "size": {
429
+ "0": 210,
430
+ "1": 46
431
+ },
432
+ "flags": {},
433
+ "order": 11,
434
+ "mode": 0,
435
+ "inputs": [
436
+ {
437
+ "name": "image1",
438
+ "type": "IMAGE",
439
+ "link": 48
440
+ },
441
+ {
442
+ "name": "image2",
443
+ "type": "IMAGE",
444
+ "link": 49
445
+ }
446
+ ],
447
+ "outputs": [
448
+ {
449
+ "name": "IMAGE",
450
+ "type": "IMAGE",
451
+ "links": [
452
+ 50
453
+ ],
454
+ "shape": 3,
455
+ "slot_index": 0
456
+ }
457
+ ],
458
+ "properties": {
459
+ "Node name for S&R": "ImageBatch"
460
+ }
461
+ },
462
+ {
463
+ "id": 25,
464
+ "type": "LoadImage",
465
+ "pos": [
466
+ -580,
467
+ -380
468
+ ],
469
+ "size": {
470
+ "0": 315,
471
+ "1": 314
472
+ },
473
+ "flags": {},
474
+ "order": 1,
475
+ "mode": 0,
476
+ "outputs": [
477
+ {
478
+ "name": "IMAGE",
479
+ "type": "IMAGE",
480
+ "links": [
481
+ 45
482
+ ],
483
+ "shape": 3,
484
+ "slot_index": 0
485
+ },
486
+ {
487
+ "name": "MASK",
488
+ "type": "MASK",
489
+ "links": null,
490
+ "shape": 3
491
+ }
492
+ ],
493
+ "properties": {
494
+ "Node name for S&R": "LoadImage"
495
+ },
496
+ "widgets_values": [
497
+ "blonde_1.png",
498
+ "image"
499
+ ]
500
+ },
501
+ {
502
+ "id": 12,
503
+ "type": "LoadImage",
504
+ "pos": [
505
+ -220,
506
+ -370
507
+ ],
508
+ "size": {
509
+ "0": 315,
510
+ "1": 314
511
+ },
512
+ "flags": {},
513
+ "order": 2,
514
+ "mode": 0,
515
+ "outputs": [
516
+ {
517
+ "name": "IMAGE",
518
+ "type": "IMAGE",
519
+ "links": [
520
+ 44
521
+ ],
522
+ "shape": 3,
523
+ "slot_index": 0
524
+ },
525
+ {
526
+ "name": "MASK",
527
+ "type": "MASK",
528
+ "links": null,
529
+ "shape": 3
530
+ }
531
+ ],
532
+ "properties": {
533
+ "Node name for S&R": "LoadImage"
534
+ },
535
+ "widgets_values": [
536
+ "blonde_2_repair.png",
537
+ "image"
538
+ ]
539
+ },
540
+ {
541
+ "id": 26,
542
+ "type": "LoadImage",
543
+ "pos": [
544
+ -580,
545
+ 0
546
+ ],
547
+ "size": {
548
+ "0": 315,
549
+ "1": 314
550
+ },
551
+ "flags": {},
552
+ "order": 3,
553
+ "mode": 0,
554
+ "outputs": [
555
+ {
556
+ "name": "IMAGE",
557
+ "type": "IMAGE",
558
+ "links": [
559
+ 47
560
+ ],
561
+ "shape": 3,
562
+ "slot_index": 0
563
+ },
564
+ {
565
+ "name": "MASK",
566
+ "type": "MASK",
567
+ "links": null,
568
+ "shape": 3
569
+ }
570
+ ],
571
+ "properties": {
572
+ "Node name for S&R": "LoadImage"
573
+ },
574
+ "widgets_values": [
575
+ "blonde_4_repair.png",
576
+ "image"
577
+ ]
578
+ },
579
+ {
580
+ "id": 24,
581
+ "type": "LoadImage",
582
+ "pos": [
583
+ -230,
584
+ 0
585
+ ],
586
+ "size": {
587
+ "0": 315,
588
+ "1": 314
589
+ },
590
+ "flags": {},
591
+ "order": 4,
592
+ "mode": 0,
593
+ "outputs": [
594
+ {
595
+ "name": "IMAGE",
596
+ "type": "IMAGE",
597
+ "links": [
598
+ 46
599
+ ],
600
+ "shape": 3,
601
+ "slot_index": 0
602
+ },
603
+ {
604
+ "name": "MASK",
605
+ "type": "MASK",
606
+ "links": null,
607
+ "shape": 3
608
+ }
609
+ ],
610
+ "properties": {
611
+ "Node name for S&R": "LoadImage"
612
+ },
613
+ "widgets_values": [
614
+ "blonde_8_repair.png",
615
+ "image"
616
+ ]
617
+ },
618
+ {
619
+ "id": 4,
620
+ "type": "CheckpointLoaderSimple",
621
+ "pos": [
622
+ 10,
623
+ 680
624
+ ],
625
+ "size": {
626
+ "0": 315,
627
+ "1": 98
628
+ },
629
+ "flags": {},
630
+ "order": 5,
631
+ "mode": 0,
632
+ "outputs": [
633
+ {
634
+ "name": "MODEL",
635
+ "type": "MODEL",
636
+ "links": [
637
+ 36
638
+ ],
639
+ "slot_index": 0
640
+ },
641
+ {
642
+ "name": "CLIP",
643
+ "type": "CLIP",
644
+ "links": [
645
+ 3,
646
+ 5
647
+ ],
648
+ "slot_index": 1
649
+ },
650
+ {
651
+ "name": "VAE",
652
+ "type": "VAE",
653
+ "links": [
654
+ 8
655
+ ],
656
+ "slot_index": 2
657
+ }
658
+ ],
659
+ "properties": {
660
+ "Node name for S&R": "CheckpointLoaderSimple"
661
+ },
662
+ "widgets_values": [
663
+ "sd15/Realistic_Vision_V5.1_fp16-no-ema.safetensors"
664
+ ]
665
+ },
666
+ {
667
+ "id": 8,
668
+ "type": "VAEDecode",
669
+ "pos": [
670
+ 1640,
671
+ 710
672
+ ],
673
+ "size": {
674
+ "0": 140,
675
+ "1": 46
676
+ },
677
+ "flags": {},
678
+ "order": 16,
679
+ "mode": 0,
680
+ "inputs": [
681
+ {
682
+ "name": "samples",
683
+ "type": "LATENT",
684
+ "link": 7
685
+ },
686
+ {
687
+ "name": "vae",
688
+ "type": "VAE",
689
+ "link": 8
690
+ }
691
+ ],
692
+ "outputs": [
693
+ {
694
+ "name": "IMAGE",
695
+ "type": "IMAGE",
696
+ "links": [
697
+ 55
698
+ ],
699
+ "slot_index": 0
700
+ }
701
+ ],
702
+ "properties": {
703
+ "Node name for S&R": "VAEDecode"
704
+ }
705
+ },
706
+ {
707
+ "id": 18,
708
+ "type": "IPAdapterFaceID",
709
+ "pos": [
710
+ 850,
711
+ 190
712
+ ],
713
+ "size": {
714
+ "0": 315,
715
+ "1": 322
716
+ },
717
+ "flags": {},
718
+ "order": 12,
719
+ "mode": 0,
720
+ "inputs": [
721
+ {
722
+ "name": "model",
723
+ "type": "MODEL",
724
+ "link": 35
725
+ },
726
+ {
727
+ "name": "ipadapter",
728
+ "type": "IPADAPTER",
729
+ "link": 34,
730
+ "slot_index": 1
731
+ },
732
+ {
733
+ "name": "image",
734
+ "type": "IMAGE",
735
+ "link": 50
736
+ },
737
+ {
738
+ "name": "image_negative",
739
+ "type": "IMAGE",
740
+ "link": null
741
+ },
742
+ {
743
+ "name": "attn_mask",
744
+ "type": "MASK",
745
+ "link": null
746
+ },
747
+ {
748
+ "name": "clip_vision",
749
+ "type": "CLIP_VISION",
750
+ "link": null
751
+ },
752
+ {
753
+ "name": "insightface",
754
+ "type": "INSIGHTFACE",
755
+ "link": null
756
+ }
757
+ ],
758
+ "outputs": [
759
+ {
760
+ "name": "MODEL",
761
+ "type": "MODEL",
762
+ "links": [
763
+ 43
764
+ ],
765
+ "shape": 3,
766
+ "slot_index": 0
767
+ },
768
+ {
769
+ "name": "face_image",
770
+ "type": "IMAGE",
771
+ "links": [
772
+ 56
773
+ ],
774
+ "shape": 3,
775
+ "slot_index": 1
776
+ }
777
+ ],
778
+ "properties": {
779
+ "Node name for S&R": "IPAdapterFaceID"
780
+ },
781
+ "widgets_values": [
782
+ 0.8,
783
+ 2,
784
+ "linear",
785
+ "concat",
786
+ 0,
787
+ 1,
788
+ "V only"
789
+ ]
790
+ },
791
+ {
792
+ "id": 33,
793
+ "type": "PreviewImage",
794
+ "pos": [
795
+ 1850,
796
+ 712
797
+ ],
798
+ "size": [
799
+ 366.926812800109,
800
+ 394.0742206376648
801
+ ],
802
+ "flags": {},
803
+ "order": 17,
804
+ "mode": 0,
805
+ "inputs": [
806
+ {
807
+ "name": "images",
808
+ "type": "IMAGE",
809
+ "link": 55
810
+ }
811
+ ],
812
+ "properties": {
813
+ "Node name for S&R": "PreviewImage"
814
+ }
815
+ }
816
+ ],
817
+ "links": [
818
+ [
819
+ 2,
820
+ 5,
821
+ 0,
822
+ 3,
823
+ 3,
824
+ "LATENT"
825
+ ],
826
+ [
827
+ 3,
828
+ 4,
829
+ 1,
830
+ 6,
831
+ 0,
832
+ "CLIP"
833
+ ],
834
+ [
835
+ 4,
836
+ 6,
837
+ 0,
838
+ 3,
839
+ 1,
840
+ "CONDITIONING"
841
+ ],
842
+ [
843
+ 5,
844
+ 4,
845
+ 1,
846
+ 7,
847
+ 0,
848
+ "CLIP"
849
+ ],
850
+ [
851
+ 6,
852
+ 7,
853
+ 0,
854
+ 3,
855
+ 2,
856
+ "CONDITIONING"
857
+ ],
858
+ [
859
+ 7,
860
+ 3,
861
+ 0,
862
+ 8,
863
+ 0,
864
+ "LATENT"
865
+ ],
866
+ [
867
+ 8,
868
+ 4,
869
+ 2,
870
+ 8,
871
+ 1,
872
+ "VAE"
873
+ ],
874
+ [
875
+ 34,
876
+ 20,
877
+ 1,
878
+ 18,
879
+ 1,
880
+ "IPADAPTER"
881
+ ],
882
+ [
883
+ 35,
884
+ 20,
885
+ 0,
886
+ 18,
887
+ 0,
888
+ "MODEL"
889
+ ],
890
+ [
891
+ 36,
892
+ 4,
893
+ 0,
894
+ 20,
895
+ 0,
896
+ "MODEL"
897
+ ],
898
+ [
899
+ 37,
900
+ 22,
901
+ 1,
902
+ 21,
903
+ 1,
904
+ "IPADAPTER"
905
+ ],
906
+ [
907
+ 38,
908
+ 20,
909
+ 1,
910
+ 22,
911
+ 1,
912
+ "IPADAPTER"
913
+ ],
914
+ [
915
+ 40,
916
+ 22,
917
+ 0,
918
+ 21,
919
+ 0,
920
+ "MODEL"
921
+ ],
922
+ [
923
+ 42,
924
+ 21,
925
+ 0,
926
+ 3,
927
+ 0,
928
+ "MODEL"
929
+ ],
930
+ [
931
+ 43,
932
+ 18,
933
+ 0,
934
+ 22,
935
+ 0,
936
+ "MODEL"
937
+ ],
938
+ [
939
+ 44,
940
+ 12,
941
+ 0,
942
+ 27,
943
+ 0,
944
+ "IMAGE"
945
+ ],
946
+ [
947
+ 45,
948
+ 25,
949
+ 0,
950
+ 27,
951
+ 1,
952
+ "IMAGE"
953
+ ],
954
+ [
955
+ 46,
956
+ 24,
957
+ 0,
958
+ 28,
959
+ 0,
960
+ "IMAGE"
961
+ ],
962
+ [
963
+ 47,
964
+ 26,
965
+ 0,
966
+ 28,
967
+ 1,
968
+ "IMAGE"
969
+ ],
970
+ [
971
+ 48,
972
+ 27,
973
+ 0,
974
+ 29,
975
+ 0,
976
+ "IMAGE"
977
+ ],
978
+ [
979
+ 49,
980
+ 28,
981
+ 0,
982
+ 29,
983
+ 1,
984
+ "IMAGE"
985
+ ],
986
+ [
987
+ 50,
988
+ 29,
989
+ 0,
990
+ 18,
991
+ 2,
992
+ "IMAGE"
993
+ ],
994
+ [
995
+ 55,
996
+ 8,
997
+ 0,
998
+ 33,
999
+ 0,
1000
+ "IMAGE"
1001
+ ],
1002
+ [
1003
+ 56,
1004
+ 18,
1005
+ 1,
1006
+ 21,
1007
+ 2,
1008
+ "IMAGE"
1009
+ ]
1010
+ ],
1011
+ "groups": [],
1012
+ "config": {},
1013
+ "extra": {
1014
+ "ds": {
1015
+ "scale": 0.5644739300537773,
1016
+ "offset": [
1017
+ 390.06644263235023,
1018
+ 603.8137061998592
1019
+ ]
1020
+ }
1021
+ },
1022
+ "version": 0.4
1023
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_ideal_faceid_config.json ADDED
@@ -0,0 +1,728 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 23,
3
+ "last_link_id": 44,
4
+ "nodes": [
5
+ {
6
+ "id": 8,
7
+ "type": "VAEDecode",
8
+ "pos": [
9
+ 1640,
10
+ 710
11
+ ],
12
+ "size": {
13
+ "0": 140,
14
+ "1": 46
15
+ },
16
+ "flags": {},
17
+ "order": 10,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "samples",
22
+ "type": "LATENT",
23
+ "link": 7
24
+ },
25
+ {
26
+ "name": "vae",
27
+ "type": "VAE",
28
+ "link": 8
29
+ }
30
+ ],
31
+ "outputs": [
32
+ {
33
+ "name": "IMAGE",
34
+ "type": "IMAGE",
35
+ "links": [
36
+ 9
37
+ ],
38
+ "slot_index": 0
39
+ }
40
+ ],
41
+ "properties": {
42
+ "Node name for S&R": "VAEDecode"
43
+ }
44
+ },
45
+ {
46
+ "id": 5,
47
+ "type": "EmptyLatentImage",
48
+ "pos": [
49
+ 870,
50
+ 1100
51
+ ],
52
+ "size": {
53
+ "0": 315,
54
+ "1": 106
55
+ },
56
+ "flags": {},
57
+ "order": 0,
58
+ "mode": 0,
59
+ "outputs": [
60
+ {
61
+ "name": "LATENT",
62
+ "type": "LATENT",
63
+ "links": [
64
+ 2
65
+ ],
66
+ "slot_index": 0
67
+ }
68
+ ],
69
+ "properties": {
70
+ "Node name for S&R": "EmptyLatentImage"
71
+ },
72
+ "widgets_values": [
73
+ 512,
74
+ 512,
75
+ 1
76
+ ]
77
+ },
78
+ {
79
+ "id": 3,
80
+ "type": "KSampler",
81
+ "pos": [
82
+ 1280,
83
+ 710
84
+ ],
85
+ "size": {
86
+ "0": 315,
87
+ "1": 262
88
+ },
89
+ "flags": {},
90
+ "order": 9,
91
+ "mode": 0,
92
+ "inputs": [
93
+ {
94
+ "name": "model",
95
+ "type": "MODEL",
96
+ "link": 42
97
+ },
98
+ {
99
+ "name": "positive",
100
+ "type": "CONDITIONING",
101
+ "link": 4
102
+ },
103
+ {
104
+ "name": "negative",
105
+ "type": "CONDITIONING",
106
+ "link": 6
107
+ },
108
+ {
109
+ "name": "latent_image",
110
+ "type": "LATENT",
111
+ "link": 2
112
+ }
113
+ ],
114
+ "outputs": [
115
+ {
116
+ "name": "LATENT",
117
+ "type": "LATENT",
118
+ "links": [
119
+ 7
120
+ ],
121
+ "slot_index": 0
122
+ }
123
+ ],
124
+ "properties": {
125
+ "Node name for S&R": "KSampler"
126
+ },
127
+ "widgets_values": [
128
+ 0,
129
+ "fixed",
130
+ 30,
131
+ 6.5,
132
+ "ddpm",
133
+ "karras",
134
+ 1
135
+ ]
136
+ },
137
+ {
138
+ "id": 9,
139
+ "type": "SaveImage",
140
+ "pos": [
141
+ 1830,
142
+ 700
143
+ ],
144
+ "size": {
145
+ "0": 529.7760009765625,
146
+ "1": 582.3048095703125
147
+ },
148
+ "flags": {},
149
+ "order": 11,
150
+ "mode": 0,
151
+ "inputs": [
152
+ {
153
+ "name": "images",
154
+ "type": "IMAGE",
155
+ "link": 9
156
+ }
157
+ ],
158
+ "properties": {},
159
+ "widgets_values": [
160
+ "IPAdapter"
161
+ ]
162
+ },
163
+ {
164
+ "id": 12,
165
+ "type": "LoadImage",
166
+ "pos": [
167
+ 450,
168
+ 240
169
+ ],
170
+ "size": {
171
+ "0": 315,
172
+ "1": 314
173
+ },
174
+ "flags": {},
175
+ "order": 1,
176
+ "mode": 0,
177
+ "outputs": [
178
+ {
179
+ "name": "IMAGE",
180
+ "type": "IMAGE",
181
+ "links": [
182
+ 29
183
+ ],
184
+ "shape": 3,
185
+ "slot_index": 0
186
+ },
187
+ {
188
+ "name": "MASK",
189
+ "type": "MASK",
190
+ "links": null,
191
+ "shape": 3
192
+ }
193
+ ],
194
+ "properties": {
195
+ "Node name for S&R": "LoadImage"
196
+ },
197
+ "widgets_values": [
198
+ "rosario_4.jpg",
199
+ "image"
200
+ ]
201
+ },
202
+ {
203
+ "id": 7,
204
+ "type": "CLIPTextEncode",
205
+ "pos": [
206
+ 760,
207
+ 850
208
+ ],
209
+ "size": {
210
+ "0": 425.27801513671875,
211
+ "1": 180.6060791015625
212
+ },
213
+ "flags": {},
214
+ "order": 5,
215
+ "mode": 0,
216
+ "inputs": [
217
+ {
218
+ "name": "clip",
219
+ "type": "CLIP",
220
+ "link": 5
221
+ }
222
+ ],
223
+ "outputs": [
224
+ {
225
+ "name": "CONDITIONING",
226
+ "type": "CONDITIONING",
227
+ "links": [
228
+ 6
229
+ ],
230
+ "slot_index": 0
231
+ }
232
+ ],
233
+ "properties": {
234
+ "Node name for S&R": "CLIPTextEncode"
235
+ },
236
+ "widgets_values": [
237
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed, naked"
238
+ ]
239
+ },
240
+ {
241
+ "id": 6,
242
+ "type": "CLIPTextEncode",
243
+ "pos": [
244
+ 760,
245
+ 620
246
+ ],
247
+ "size": {
248
+ "0": 422.84503173828125,
249
+ "1": 164.31304931640625
250
+ },
251
+ "flags": {},
252
+ "order": 4,
253
+ "mode": 0,
254
+ "inputs": [
255
+ {
256
+ "name": "clip",
257
+ "type": "CLIP",
258
+ "link": 3
259
+ }
260
+ ],
261
+ "outputs": [
262
+ {
263
+ "name": "CONDITIONING",
264
+ "type": "CONDITIONING",
265
+ "links": [
266
+ 4
267
+ ],
268
+ "slot_index": 0
269
+ }
270
+ ],
271
+ "properties": {
272
+ "Node name for S&R": "CLIPTextEncode"
273
+ },
274
+ "widgets_values": [
275
+ "closeup of a beautiful woman wearing a black dress on the seaside\n\nserene, sunset, spring, high quality, detailed, diffuse light"
276
+ ]
277
+ },
278
+ {
279
+ "id": 4,
280
+ "type": "CheckpointLoaderSimple",
281
+ "pos": [
282
+ 10,
283
+ 680
284
+ ],
285
+ "size": {
286
+ "0": 315,
287
+ "1": 98
288
+ },
289
+ "flags": {},
290
+ "order": 2,
291
+ "mode": 0,
292
+ "outputs": [
293
+ {
294
+ "name": "MODEL",
295
+ "type": "MODEL",
296
+ "links": [
297
+ 36
298
+ ],
299
+ "slot_index": 0
300
+ },
301
+ {
302
+ "name": "CLIP",
303
+ "type": "CLIP",
304
+ "links": [
305
+ 3,
306
+ 5
307
+ ],
308
+ "slot_index": 1
309
+ },
310
+ {
311
+ "name": "VAE",
312
+ "type": "VAE",
313
+ "links": [
314
+ 8
315
+ ],
316
+ "slot_index": 2
317
+ }
318
+ ],
319
+ "properties": {
320
+ "Node name for S&R": "CheckpointLoaderSimple"
321
+ },
322
+ "widgets_values": [
323
+ "sd15/realisticVisionV51_v51VAE.safetensors"
324
+ ]
325
+ },
326
+ {
327
+ "id": 20,
328
+ "type": "IPAdapterUnifiedLoaderFaceID",
329
+ "pos": [
330
+ 460,
331
+ 60
332
+ ],
333
+ "size": {
334
+ "0": 315,
335
+ "1": 126
336
+ },
337
+ "flags": {},
338
+ "order": 3,
339
+ "mode": 0,
340
+ "inputs": [
341
+ {
342
+ "name": "model",
343
+ "type": "MODEL",
344
+ "link": 36
345
+ },
346
+ {
347
+ "name": "ipadapter",
348
+ "type": "IPADAPTER",
349
+ "link": null
350
+ }
351
+ ],
352
+ "outputs": [
353
+ {
354
+ "name": "MODEL",
355
+ "type": "MODEL",
356
+ "links": [
357
+ 35
358
+ ],
359
+ "shape": 3,
360
+ "slot_index": 0
361
+ },
362
+ {
363
+ "name": "ipadapter",
364
+ "type": "IPADAPTER",
365
+ "links": [
366
+ 34,
367
+ 38
368
+ ],
369
+ "shape": 3,
370
+ "slot_index": 1
371
+ }
372
+ ],
373
+ "properties": {
374
+ "Node name for S&R": "IPAdapterUnifiedLoaderFaceID"
375
+ },
376
+ "widgets_values": [
377
+ "FACEID PLUS V2",
378
+ 0.6,
379
+ "CPU"
380
+ ]
381
+ },
382
+ {
383
+ "id": 22,
384
+ "type": "IPAdapterUnifiedLoader",
385
+ "pos": [
386
+ 855,
387
+ 51
388
+ ],
389
+ "size": {
390
+ "0": 315,
391
+ "1": 78
392
+ },
393
+ "flags": {},
394
+ "order": 7,
395
+ "mode": 0,
396
+ "inputs": [
397
+ {
398
+ "name": "model",
399
+ "type": "MODEL",
400
+ "link": 43
401
+ },
402
+ {
403
+ "name": "ipadapter",
404
+ "type": "IPADAPTER",
405
+ "link": 38
406
+ }
407
+ ],
408
+ "outputs": [
409
+ {
410
+ "name": "model",
411
+ "type": "MODEL",
412
+ "links": [
413
+ 40
414
+ ],
415
+ "shape": 3,
416
+ "slot_index": 0
417
+ },
418
+ {
419
+ "name": "ipadapter",
420
+ "type": "IPADAPTER",
421
+ "links": [
422
+ 37
423
+ ],
424
+ "shape": 3
425
+ }
426
+ ],
427
+ "properties": {
428
+ "Node name for S&R": "IPAdapterUnifiedLoader"
429
+ },
430
+ "widgets_values": [
431
+ "FULL FACE - SD1.5 only (portraits stronger)"
432
+ ]
433
+ },
434
+ {
435
+ "id": 21,
436
+ "type": "IPAdapter",
437
+ "pos": [
438
+ 1280,
439
+ 170
440
+ ],
441
+ "size": {
442
+ "0": 315,
443
+ "1": 190
444
+ },
445
+ "flags": {},
446
+ "order": 8,
447
+ "mode": 0,
448
+ "inputs": [
449
+ {
450
+ "name": "model",
451
+ "type": "MODEL",
452
+ "link": 40
453
+ },
454
+ {
455
+ "name": "ipadapter",
456
+ "type": "IPADAPTER",
457
+ "link": 37,
458
+ "slot_index": 1
459
+ },
460
+ {
461
+ "name": "image",
462
+ "type": "IMAGE",
463
+ "link": 44
464
+ },
465
+ {
466
+ "name": "attn_mask",
467
+ "type": "MASK",
468
+ "link": null
469
+ }
470
+ ],
471
+ "outputs": [
472
+ {
473
+ "name": "MODEL",
474
+ "type": "MODEL",
475
+ "links": [
476
+ 42
477
+ ],
478
+ "shape": 3,
479
+ "slot_index": 0
480
+ }
481
+ ],
482
+ "properties": {
483
+ "Node name for S&R": "IPAdapter"
484
+ },
485
+ "widgets_values": [
486
+ 0.4,
487
+ 0,
488
+ 1,
489
+ "standard"
490
+ ]
491
+ },
492
+ {
493
+ "id": 18,
494
+ "type": "IPAdapterFaceID",
495
+ "pos": [
496
+ 850,
497
+ 190
498
+ ],
499
+ "size": {
500
+ "0": 315,
501
+ "1": 322
502
+ },
503
+ "flags": {},
504
+ "order": 6,
505
+ "mode": 0,
506
+ "inputs": [
507
+ {
508
+ "name": "model",
509
+ "type": "MODEL",
510
+ "link": 35
511
+ },
512
+ {
513
+ "name": "ipadapter",
514
+ "type": "IPADAPTER",
515
+ "link": 34,
516
+ "slot_index": 1
517
+ },
518
+ {
519
+ "name": "image",
520
+ "type": "IMAGE",
521
+ "link": 29
522
+ },
523
+ {
524
+ "name": "image_negative",
525
+ "type": "IMAGE",
526
+ "link": null
527
+ },
528
+ {
529
+ "name": "attn_mask",
530
+ "type": "MASK",
531
+ "link": null
532
+ },
533
+ {
534
+ "name": "clip_vision",
535
+ "type": "CLIP_VISION",
536
+ "link": null
537
+ },
538
+ {
539
+ "name": "insightface",
540
+ "type": "INSIGHTFACE",
541
+ "link": null
542
+ }
543
+ ],
544
+ "outputs": [
545
+ {
546
+ "name": "MODEL",
547
+ "type": "MODEL",
548
+ "links": [
549
+ 43
550
+ ],
551
+ "shape": 3,
552
+ "slot_index": 0
553
+ },
554
+ {
555
+ "name": "face_image",
556
+ "type": "IMAGE",
557
+ "links": [
558
+ 44
559
+ ],
560
+ "shape": 3,
561
+ "slot_index": 1
562
+ }
563
+ ],
564
+ "properties": {
565
+ "Node name for S&R": "IPAdapterFaceID"
566
+ },
567
+ "widgets_values": [
568
+ 0.8,
569
+ 2,
570
+ "linear",
571
+ "concat",
572
+ 0,
573
+ 1,
574
+ "V only"
575
+ ]
576
+ }
577
+ ],
578
+ "links": [
579
+ [
580
+ 2,
581
+ 5,
582
+ 0,
583
+ 3,
584
+ 3,
585
+ "LATENT"
586
+ ],
587
+ [
588
+ 3,
589
+ 4,
590
+ 1,
591
+ 6,
592
+ 0,
593
+ "CLIP"
594
+ ],
595
+ [
596
+ 4,
597
+ 6,
598
+ 0,
599
+ 3,
600
+ 1,
601
+ "CONDITIONING"
602
+ ],
603
+ [
604
+ 5,
605
+ 4,
606
+ 1,
607
+ 7,
608
+ 0,
609
+ "CLIP"
610
+ ],
611
+ [
612
+ 6,
613
+ 7,
614
+ 0,
615
+ 3,
616
+ 2,
617
+ "CONDITIONING"
618
+ ],
619
+ [
620
+ 7,
621
+ 3,
622
+ 0,
623
+ 8,
624
+ 0,
625
+ "LATENT"
626
+ ],
627
+ [
628
+ 8,
629
+ 4,
630
+ 2,
631
+ 8,
632
+ 1,
633
+ "VAE"
634
+ ],
635
+ [
636
+ 9,
637
+ 8,
638
+ 0,
639
+ 9,
640
+ 0,
641
+ "IMAGE"
642
+ ],
643
+ [
644
+ 29,
645
+ 12,
646
+ 0,
647
+ 18,
648
+ 2,
649
+ "IMAGE"
650
+ ],
651
+ [
652
+ 34,
653
+ 20,
654
+ 1,
655
+ 18,
656
+ 1,
657
+ "IPADAPTER"
658
+ ],
659
+ [
660
+ 35,
661
+ 20,
662
+ 0,
663
+ 18,
664
+ 0,
665
+ "MODEL"
666
+ ],
667
+ [
668
+ 36,
669
+ 4,
670
+ 0,
671
+ 20,
672
+ 0,
673
+ "MODEL"
674
+ ],
675
+ [
676
+ 37,
677
+ 22,
678
+ 1,
679
+ 21,
680
+ 1,
681
+ "IPADAPTER"
682
+ ],
683
+ [
684
+ 38,
685
+ 20,
686
+ 1,
687
+ 22,
688
+ 1,
689
+ "IPADAPTER"
690
+ ],
691
+ [
692
+ 40,
693
+ 22,
694
+ 0,
695
+ 21,
696
+ 0,
697
+ "MODEL"
698
+ ],
699
+ [
700
+ 42,
701
+ 21,
702
+ 0,
703
+ 3,
704
+ 0,
705
+ "MODEL"
706
+ ],
707
+ [
708
+ 43,
709
+ 18,
710
+ 0,
711
+ 22,
712
+ 0,
713
+ "MODEL"
714
+ ],
715
+ [
716
+ 44,
717
+ 18,
718
+ 1,
719
+ 21,
720
+ 2,
721
+ "IMAGE"
722
+ ]
723
+ ],
724
+ "groups": [],
725
+ "config": {},
726
+ "extra": {},
727
+ "version": 0.4
728
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_kolors.json ADDED
@@ -0,0 +1,680 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 88,
3
+ "last_link_id": 132,
4
+ "nodes": [
5
+ {
6
+ "id": 9,
7
+ "type": "EmptyLatentImage",
8
+ "pos": [
9
+ 1710,
10
+ 620
11
+ ],
12
+ "size": {
13
+ "0": 368.5347900390625,
14
+ "1": 106
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "LATENT",
22
+ "type": "LATENT",
23
+ "links": [
24
+ 108
25
+ ],
26
+ "shape": 3,
27
+ "label": "Latent"
28
+ }
29
+ ],
30
+ "properties": {
31
+ "Node name for S&R": "EmptyLatentImage"
32
+ },
33
+ "widgets_values": [
34
+ 968,
35
+ 1152,
36
+ 1
37
+ ]
38
+ },
39
+ {
40
+ "id": 80,
41
+ "type": "VAEDecode",
42
+ "pos": [
43
+ 2690,
44
+ 110
45
+ ],
46
+ "size": {
47
+ "0": 210,
48
+ "1": 46
49
+ },
50
+ "flags": {},
51
+ "order": 11,
52
+ "mode": 0,
53
+ "inputs": [
54
+ {
55
+ "name": "samples",
56
+ "type": "LATENT",
57
+ "link": 110
58
+ },
59
+ {
60
+ "name": "vae",
61
+ "type": "VAE",
62
+ "link": 111
63
+ }
64
+ ],
65
+ "outputs": [
66
+ {
67
+ "name": "IMAGE",
68
+ "type": "IMAGE",
69
+ "links": [
70
+ 113
71
+ ],
72
+ "shape": 3,
73
+ "slot_index": 0
74
+ }
75
+ ],
76
+ "properties": {
77
+ "Node name for S&R": "VAEDecode"
78
+ }
79
+ },
80
+ {
81
+ "id": 81,
82
+ "type": "PreviewImage",
83
+ "pos": [
84
+ 2700,
85
+ 210
86
+ ],
87
+ "size": {
88
+ "0": 1085.9268798828125,
89
+ "1": 1301.6563720703125
90
+ },
91
+ "flags": {},
92
+ "order": 12,
93
+ "mode": 0,
94
+ "inputs": [
95
+ {
96
+ "name": "images",
97
+ "type": "IMAGE",
98
+ "link": 113
99
+ }
100
+ ],
101
+ "properties": {
102
+ "Node name for S&R": "PreviewImage"
103
+ }
104
+ },
105
+ {
106
+ "id": 59,
107
+ "type": "MZ_KolorsUNETLoader",
108
+ "pos": [
109
+ 1140,
110
+ 300
111
+ ],
112
+ "size": {
113
+ "0": 310.1650695800781,
114
+ "1": 78
115
+ },
116
+ "flags": {},
117
+ "order": 1,
118
+ "mode": 0,
119
+ "outputs": [
120
+ {
121
+ "name": "model",
122
+ "type": "MODEL",
123
+ "links": [
124
+ 132
125
+ ],
126
+ "shape": 3,
127
+ "label": "model",
128
+ "slot_index": 0
129
+ },
130
+ {
131
+ "name": "hid_proj",
132
+ "type": "TorchLinear",
133
+ "links": [
134
+ 79,
135
+ 87
136
+ ],
137
+ "shape": 3,
138
+ "label": "hid_proj",
139
+ "slot_index": 1
140
+ }
141
+ ],
142
+ "properties": {
143
+ "Node name for S&R": "MZ_KolorsUNETLoader"
144
+ },
145
+ "widgets_values": [
146
+ "diffusion_pytorch_model.fp16.safetensors"
147
+ ]
148
+ },
149
+ {
150
+ "id": 75,
151
+ "type": "IPAdapterAdvanced",
152
+ "pos": [
153
+ 1919,
154
+ -273
155
+ ],
156
+ "size": {
157
+ "0": 291.9587097167969,
158
+ "1": 278
159
+ },
160
+ "flags": {},
161
+ "order": 7,
162
+ "mode": 0,
163
+ "inputs": [
164
+ {
165
+ "name": "model",
166
+ "type": "MODEL",
167
+ "link": 132,
168
+ "slot_index": 0
169
+ },
170
+ {
171
+ "name": "ipadapter",
172
+ "type": "IPADAPTER",
173
+ "link": 130,
174
+ "slot_index": 1
175
+ },
176
+ {
177
+ "name": "image",
178
+ "type": "IMAGE",
179
+ "link": 102,
180
+ "slot_index": 2
181
+ },
182
+ {
183
+ "name": "image_negative",
184
+ "type": "IMAGE",
185
+ "link": null
186
+ },
187
+ {
188
+ "name": "attn_mask",
189
+ "type": "MASK",
190
+ "link": null
191
+ },
192
+ {
193
+ "name": "clip_vision",
194
+ "type": "CLIP_VISION",
195
+ "link": 131,
196
+ "slot_index": 5
197
+ }
198
+ ],
199
+ "outputs": [
200
+ {
201
+ "name": "MODEL",
202
+ "type": "MODEL",
203
+ "links": [
204
+ 105
205
+ ],
206
+ "shape": 3,
207
+ "slot_index": 0
208
+ }
209
+ ],
210
+ "properties": {
211
+ "Node name for S&R": "IPAdapterAdvanced"
212
+ },
213
+ "widgets_values": [
214
+ 1,
215
+ "style transfer precise",
216
+ "concat",
217
+ 0,
218
+ 1,
219
+ "V only"
220
+ ]
221
+ },
222
+ {
223
+ "id": 76,
224
+ "type": "IPAdapterModelLoader",
225
+ "pos": [
226
+ 1541,
227
+ -383
228
+ ],
229
+ "size": {
230
+ "0": 315,
231
+ "1": 58
232
+ },
233
+ "flags": {},
234
+ "order": 2,
235
+ "mode": 0,
236
+ "outputs": [
237
+ {
238
+ "name": "IPADAPTER",
239
+ "type": "IPADAPTER",
240
+ "links": [
241
+ 130
242
+ ],
243
+ "shape": 3,
244
+ "slot_index": 0
245
+ }
246
+ ],
247
+ "properties": {
248
+ "Node name for S&R": "IPAdapterModelLoader"
249
+ },
250
+ "widgets_values": [
251
+ "Kolors-IP-Adapter-Plus.bin"
252
+ ]
253
+ },
254
+ {
255
+ "id": 78,
256
+ "type": "CLIPVisionLoader",
257
+ "pos": [
258
+ 1511,
259
+ -127
260
+ ],
261
+ "size": {
262
+ "0": 315,
263
+ "1": 58
264
+ },
265
+ "flags": {},
266
+ "order": 3,
267
+ "mode": 0,
268
+ "outputs": [
269
+ {
270
+ "name": "CLIP_VISION",
271
+ "type": "CLIP_VISION",
272
+ "links": [
273
+ 131
274
+ ],
275
+ "shape": 3,
276
+ "slot_index": 0
277
+ }
278
+ ],
279
+ "properties": {
280
+ "Node name for S&R": "CLIPVisionLoader"
281
+ },
282
+ "widgets_values": [
283
+ "clip-vit-large-patch14-336.bin"
284
+ ]
285
+ },
286
+ {
287
+ "id": 77,
288
+ "type": "LoadImage",
289
+ "pos": [
290
+ 1137,
291
+ -329
292
+ ],
293
+ "size": {
294
+ "0": 237.2888641357422,
295
+ "1": 323.4468994140625
296
+ },
297
+ "flags": {},
298
+ "order": 4,
299
+ "mode": 0,
300
+ "outputs": [
301
+ {
302
+ "name": "IMAGE",
303
+ "type": "IMAGE",
304
+ "links": [
305
+ 102
306
+ ],
307
+ "shape": 3
308
+ },
309
+ {
310
+ "name": "MASK",
311
+ "type": "MASK",
312
+ "links": null,
313
+ "shape": 3
314
+ }
315
+ ],
316
+ "properties": {
317
+ "Node name for S&R": "LoadImage"
318
+ },
319
+ "widgets_values": [
320
+ "cga_pixels.png",
321
+ "image"
322
+ ]
323
+ },
324
+ {
325
+ "id": 70,
326
+ "type": "VAELoader",
327
+ "pos": [
328
+ 1130,
329
+ 450
330
+ ],
331
+ "size": {
332
+ "0": 315,
333
+ "1": 58
334
+ },
335
+ "flags": {},
336
+ "order": 5,
337
+ "mode": 0,
338
+ "outputs": [
339
+ {
340
+ "name": "VAE",
341
+ "type": "VAE",
342
+ "links": [
343
+ 111
344
+ ],
345
+ "shape": 3,
346
+ "slot_index": 0
347
+ }
348
+ ],
349
+ "properties": {
350
+ "Node name for S&R": "VAELoader"
351
+ },
352
+ "widgets_values": [
353
+ "sdxl_vae.safetensors"
354
+ ]
355
+ },
356
+ {
357
+ "id": 79,
358
+ "type": "KSampler",
359
+ "pos": [
360
+ 2320,
361
+ 110
362
+ ],
363
+ "size": {
364
+ "0": 315,
365
+ "1": 262
366
+ },
367
+ "flags": {},
368
+ "order": 10,
369
+ "mode": 0,
370
+ "inputs": [
371
+ {
372
+ "name": "model",
373
+ "type": "MODEL",
374
+ "link": 105
375
+ },
376
+ {
377
+ "name": "positive",
378
+ "type": "CONDITIONING",
379
+ "link": 107
380
+ },
381
+ {
382
+ "name": "negative",
383
+ "type": "CONDITIONING",
384
+ "link": 106
385
+ },
386
+ {
387
+ "name": "latent_image",
388
+ "type": "LATENT",
389
+ "link": 108
390
+ }
391
+ ],
392
+ "outputs": [
393
+ {
394
+ "name": "LATENT",
395
+ "type": "LATENT",
396
+ "links": [
397
+ 110
398
+ ],
399
+ "shape": 3,
400
+ "slot_index": 0
401
+ }
402
+ ],
403
+ "properties": {
404
+ "Node name for S&R": "KSampler"
405
+ },
406
+ "widgets_values": [
407
+ 13,
408
+ "fixed",
409
+ 30,
410
+ 6.5,
411
+ "dpmpp_2m_sde_gpu",
412
+ "karras",
413
+ 1
414
+ ]
415
+ },
416
+ {
417
+ "id": 67,
418
+ "type": "MZ_ChatGLM3",
419
+ "pos": [
420
+ 1680,
421
+ 80
422
+ ],
423
+ "size": {
424
+ "0": 400,
425
+ "1": 200
426
+ },
427
+ "flags": {},
428
+ "order": 9,
429
+ "mode": 0,
430
+ "inputs": [
431
+ {
432
+ "name": "chatglm3_model",
433
+ "type": "CHATGLM3MODEL",
434
+ "link": 86,
435
+ "label": "chatglm3_model",
436
+ "slot_index": 0
437
+ },
438
+ {
439
+ "name": "hid_proj",
440
+ "type": "TorchLinear",
441
+ "link": 87,
442
+ "label": "hid_proj"
443
+ }
444
+ ],
445
+ "outputs": [
446
+ {
447
+ "name": "CONDITIONING",
448
+ "type": "CONDITIONING",
449
+ "links": [
450
+ 107
451
+ ],
452
+ "shape": 3,
453
+ "label": "CONDITIONING",
454
+ "slot_index": 0
455
+ }
456
+ ],
457
+ "properties": {
458
+ "Node name for S&R": "MZ_ChatGLM3"
459
+ },
460
+ "widgets_values": [
461
+ "a fierce red hair warrior woman wearing a white and gold armor with purple decorations. Highly detailed digital illustration, high quality, detailed, intricate"
462
+ ]
463
+ },
464
+ {
465
+ "id": 66,
466
+ "type": "MZ_ChatGLM3Loader",
467
+ "pos": [
468
+ 1140,
469
+ 180
470
+ ],
471
+ "size": {
472
+ "0": 315,
473
+ "1": 58
474
+ },
475
+ "flags": {},
476
+ "order": 6,
477
+ "mode": 0,
478
+ "outputs": [
479
+ {
480
+ "name": "chatglm3_model",
481
+ "type": "CHATGLM3MODEL",
482
+ "links": [
483
+ 84,
484
+ 86
485
+ ],
486
+ "shape": 3,
487
+ "label": "chatglm3_model"
488
+ }
489
+ ],
490
+ "properties": {
491
+ "Node name for S&R": "MZ_ChatGLM3Loader"
492
+ },
493
+ "widgets_values": [
494
+ "chatglm3-8bit.safetensors"
495
+ ]
496
+ },
497
+ {
498
+ "id": 62,
499
+ "type": "MZ_ChatGLM3",
500
+ "pos": [
501
+ 1680,
502
+ 340
503
+ ],
504
+ "size": {
505
+ "0": 400,
506
+ "1": 200
507
+ },
508
+ "flags": {},
509
+ "order": 8,
510
+ "mode": 0,
511
+ "inputs": [
512
+ {
513
+ "name": "chatglm3_model",
514
+ "type": "CHATGLM3MODEL",
515
+ "link": 84,
516
+ "label": "chatglm3_model",
517
+ "slot_index": 0
518
+ },
519
+ {
520
+ "name": "hid_proj",
521
+ "type": "TorchLinear",
522
+ "link": 79,
523
+ "label": "hid_proj"
524
+ }
525
+ ],
526
+ "outputs": [
527
+ {
528
+ "name": "CONDITIONING",
529
+ "type": "CONDITIONING",
530
+ "links": [
531
+ 106
532
+ ],
533
+ "shape": 3,
534
+ "label": "CONDITIONING",
535
+ "slot_index": 0
536
+ }
537
+ ],
538
+ "properties": {
539
+ "Node name for S&R": "MZ_ChatGLM3"
540
+ },
541
+ "widgets_values": [
542
+ ""
543
+ ]
544
+ }
545
+ ],
546
+ "links": [
547
+ [
548
+ 79,
549
+ 59,
550
+ 1,
551
+ 62,
552
+ 1,
553
+ "TorchLinear"
554
+ ],
555
+ [
556
+ 84,
557
+ 66,
558
+ 0,
559
+ 62,
560
+ 0,
561
+ "CHATGLM3MODEL"
562
+ ],
563
+ [
564
+ 86,
565
+ 66,
566
+ 0,
567
+ 67,
568
+ 0,
569
+ "CHATGLM3MODEL"
570
+ ],
571
+ [
572
+ 87,
573
+ 59,
574
+ 1,
575
+ 67,
576
+ 1,
577
+ "TorchLinear"
578
+ ],
579
+ [
580
+ 102,
581
+ 77,
582
+ 0,
583
+ 75,
584
+ 2,
585
+ "IMAGE"
586
+ ],
587
+ [
588
+ 105,
589
+ 75,
590
+ 0,
591
+ 79,
592
+ 0,
593
+ "MODEL"
594
+ ],
595
+ [
596
+ 106,
597
+ 62,
598
+ 0,
599
+ 79,
600
+ 2,
601
+ "CONDITIONING"
602
+ ],
603
+ [
604
+ 107,
605
+ 67,
606
+ 0,
607
+ 79,
608
+ 1,
609
+ "CONDITIONING"
610
+ ],
611
+ [
612
+ 108,
613
+ 9,
614
+ 0,
615
+ 79,
616
+ 3,
617
+ "LATENT"
618
+ ],
619
+ [
620
+ 110,
621
+ 79,
622
+ 0,
623
+ 80,
624
+ 0,
625
+ "LATENT"
626
+ ],
627
+ [
628
+ 111,
629
+ 70,
630
+ 0,
631
+ 80,
632
+ 1,
633
+ "VAE"
634
+ ],
635
+ [
636
+ 113,
637
+ 80,
638
+ 0,
639
+ 81,
640
+ 0,
641
+ "IMAGE"
642
+ ],
643
+ [
644
+ 130,
645
+ 76,
646
+ 0,
647
+ 75,
648
+ 1,
649
+ "IPADAPTER"
650
+ ],
651
+ [
652
+ 131,
653
+ 78,
654
+ 0,
655
+ 75,
656
+ 5,
657
+ "CLIP_VISION"
658
+ ],
659
+ [
660
+ 132,
661
+ 59,
662
+ 0,
663
+ 75,
664
+ 0,
665
+ "MODEL"
666
+ ]
667
+ ],
668
+ "groups": [],
669
+ "config": {},
670
+ "extra": {
671
+ "ds": {
672
+ "scale": 0.620921323059155,
673
+ "offset": [
674
+ -781.0947110324239,
675
+ 731.4168331979325
676
+ ]
677
+ }
678
+ },
679
+ "version": 0.4
680
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_negative_image.json ADDED
@@ -0,0 +1,956 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 24,
3
+ "last_link_id": 49,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ 50,
10
+ 730
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 20,
25
+ 44
26
+ ],
27
+ "slot_index": 0
28
+ },
29
+ {
30
+ "name": "CLIP",
31
+ "type": "CLIP",
32
+ "links": [
33
+ 3,
34
+ 5
35
+ ],
36
+ "slot_index": 1
37
+ },
38
+ {
39
+ "name": "VAE",
40
+ "type": "VAE",
41
+ "links": [
42
+ 8,
43
+ 42
44
+ ],
45
+ "slot_index": 2
46
+ }
47
+ ],
48
+ "properties": {
49
+ "Node name for S&R": "CheckpointLoaderSimple"
50
+ },
51
+ "widgets_values": [
52
+ "sd15/realisticVisionV51_v51VAE.safetensors"
53
+ ]
54
+ },
55
+ {
56
+ "id": 9,
57
+ "type": "SaveImage",
58
+ "pos": [
59
+ 1770,
60
+ 710
61
+ ],
62
+ "size": {
63
+ "0": 529.7760009765625,
64
+ "1": 582.3048095703125
65
+ },
66
+ "flags": {},
67
+ "order": 15,
68
+ "mode": 0,
69
+ "inputs": [
70
+ {
71
+ "name": "images",
72
+ "type": "IMAGE",
73
+ "link": 9
74
+ }
75
+ ],
76
+ "properties": {},
77
+ "widgets_values": [
78
+ "IPAdapter"
79
+ ]
80
+ },
81
+ {
82
+ "id": 7,
83
+ "type": "CLIPTextEncode",
84
+ "pos": [
85
+ 690,
86
+ 840
87
+ ],
88
+ "size": {
89
+ "0": 425.27801513671875,
90
+ "1": 180.6060791015625
91
+ },
92
+ "flags": {},
93
+ "order": 7,
94
+ "mode": 0,
95
+ "inputs": [
96
+ {
97
+ "name": "clip",
98
+ "type": "CLIP",
99
+ "link": 5
100
+ }
101
+ ],
102
+ "outputs": [
103
+ {
104
+ "name": "CONDITIONING",
105
+ "type": "CONDITIONING",
106
+ "links": [
107
+ 6,
108
+ 39
109
+ ],
110
+ "slot_index": 0
111
+ }
112
+ ],
113
+ "properties": {
114
+ "Node name for S&R": "CLIPTextEncode"
115
+ },
116
+ "widgets_values": [
117
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
118
+ ]
119
+ },
120
+ {
121
+ "id": 5,
122
+ "type": "EmptyLatentImage",
123
+ "pos": [
124
+ 801,
125
+ 1097
126
+ ],
127
+ "size": {
128
+ "0": 315,
129
+ "1": 106
130
+ },
131
+ "flags": {},
132
+ "order": 1,
133
+ "mode": 0,
134
+ "outputs": [
135
+ {
136
+ "name": "LATENT",
137
+ "type": "LATENT",
138
+ "links": [
139
+ 2,
140
+ 40
141
+ ],
142
+ "slot_index": 0
143
+ }
144
+ ],
145
+ "properties": {
146
+ "Node name for S&R": "EmptyLatentImage"
147
+ },
148
+ "widgets_values": [
149
+ 512,
150
+ 512,
151
+ 1
152
+ ]
153
+ },
154
+ {
155
+ "id": 16,
156
+ "type": "CLIPVisionLoader",
157
+ "pos": [
158
+ 308,
159
+ 161
160
+ ],
161
+ "size": {
162
+ "0": 315,
163
+ "1": 58
164
+ },
165
+ "flags": {},
166
+ "order": 2,
167
+ "mode": 0,
168
+ "outputs": [
169
+ {
170
+ "name": "CLIP_VISION",
171
+ "type": "CLIP_VISION",
172
+ "links": [
173
+ 24,
174
+ 48
175
+ ],
176
+ "shape": 3
177
+ }
178
+ ],
179
+ "properties": {
180
+ "Node name for S&R": "CLIPVisionLoader"
181
+ },
182
+ "widgets_values": [
183
+ "IPAdapter_image_encoder_sd15.safetensors"
184
+ ]
185
+ },
186
+ {
187
+ "id": 15,
188
+ "type": "IPAdapterModelLoader",
189
+ "pos": [
190
+ 308,
191
+ 52
192
+ ],
193
+ "size": {
194
+ "0": 315,
195
+ "1": 58
196
+ },
197
+ "flags": {},
198
+ "order": 3,
199
+ "mode": 0,
200
+ "outputs": [
201
+ {
202
+ "name": "IPADAPTER",
203
+ "type": "IPADAPTER",
204
+ "links": [
205
+ 33,
206
+ 45
207
+ ],
208
+ "shape": 3
209
+ }
210
+ ],
211
+ "properties": {
212
+ "Node name for S&R": "IPAdapterModelLoader"
213
+ },
214
+ "widgets_values": [
215
+ "ip-adapter-plus_sd15.safetensors"
216
+ ]
217
+ },
218
+ {
219
+ "id": 3,
220
+ "type": "KSampler",
221
+ "pos": [
222
+ 1210,
223
+ 700
224
+ ],
225
+ "size": {
226
+ "0": 315,
227
+ "1": 262
228
+ },
229
+ "flags": {},
230
+ "order": 11,
231
+ "mode": 0,
232
+ "inputs": [
233
+ {
234
+ "name": "model",
235
+ "type": "MODEL",
236
+ "link": 23
237
+ },
238
+ {
239
+ "name": "positive",
240
+ "type": "CONDITIONING",
241
+ "link": 4
242
+ },
243
+ {
244
+ "name": "negative",
245
+ "type": "CONDITIONING",
246
+ "link": 6
247
+ },
248
+ {
249
+ "name": "latent_image",
250
+ "type": "LATENT",
251
+ "link": 2
252
+ }
253
+ ],
254
+ "outputs": [
255
+ {
256
+ "name": "LATENT",
257
+ "type": "LATENT",
258
+ "links": [
259
+ 7
260
+ ],
261
+ "slot_index": 0
262
+ }
263
+ ],
264
+ "properties": {
265
+ "Node name for S&R": "KSampler"
266
+ },
267
+ "widgets_values": [
268
+ 0,
269
+ "fixed",
270
+ 30,
271
+ 6.5,
272
+ "dpmpp_2m_sde_gpu",
273
+ "exponential",
274
+ 1
275
+ ]
276
+ },
277
+ {
278
+ "id": 8,
279
+ "type": "VAEDecode",
280
+ "pos": [
281
+ 1575,
282
+ 705
283
+ ],
284
+ "size": {
285
+ "0": 140,
286
+ "1": 46
287
+ },
288
+ "flags": {},
289
+ "order": 13,
290
+ "mode": 0,
291
+ "inputs": [
292
+ {
293
+ "name": "samples",
294
+ "type": "LATENT",
295
+ "link": 7
296
+ },
297
+ {
298
+ "name": "vae",
299
+ "type": "VAE",
300
+ "link": 8
301
+ }
302
+ ],
303
+ "outputs": [
304
+ {
305
+ "name": "IMAGE",
306
+ "type": "IMAGE",
307
+ "links": [
308
+ 9
309
+ ],
310
+ "slot_index": 0
311
+ }
312
+ ],
313
+ "properties": {
314
+ "Node name for S&R": "VAEDecode"
315
+ }
316
+ },
317
+ {
318
+ "id": 6,
319
+ "type": "CLIPTextEncode",
320
+ "pos": [
321
+ 690,
322
+ 610
323
+ ],
324
+ "size": {
325
+ "0": 422.84503173828125,
326
+ "1": 164.31304931640625
327
+ },
328
+ "flags": {},
329
+ "order": 6,
330
+ "mode": 0,
331
+ "inputs": [
332
+ {
333
+ "name": "clip",
334
+ "type": "CLIP",
335
+ "link": 3
336
+ }
337
+ ],
338
+ "outputs": [
339
+ {
340
+ "name": "CONDITIONING",
341
+ "type": "CONDITIONING",
342
+ "links": [
343
+ 4,
344
+ 38
345
+ ],
346
+ "slot_index": 0
347
+ }
348
+ ],
349
+ "properties": {
350
+ "Node name for S&R": "CLIPTextEncode"
351
+ },
352
+ "widgets_values": [
353
+ "a castle on a cliff\n\nhigh quality, detailed, diffuse light"
354
+ ]
355
+ },
356
+ {
357
+ "id": 24,
358
+ "type": "IPAdapterAdvanced",
359
+ "pos": [
360
+ 1800,
361
+ 330
362
+ ],
363
+ "size": {
364
+ "0": 315,
365
+ "1": 254
366
+ },
367
+ "flags": {},
368
+ "order": 10,
369
+ "mode": 0,
370
+ "inputs": [
371
+ {
372
+ "name": "model",
373
+ "type": "MODEL",
374
+ "link": 44
375
+ },
376
+ {
377
+ "name": "ipadapter",
378
+ "type": "IPADAPTER",
379
+ "link": 45,
380
+ "slot_index": 1
381
+ },
382
+ {
383
+ "name": "image",
384
+ "type": "IMAGE",
385
+ "link": 46
386
+ },
387
+ {
388
+ "name": "image_negative",
389
+ "type": "IMAGE",
390
+ "link": 49
391
+ },
392
+ {
393
+ "name": "attn_mask",
394
+ "type": "MASK",
395
+ "link": null
396
+ },
397
+ {
398
+ "name": "clip_vision",
399
+ "type": "CLIP_VISION",
400
+ "link": 48,
401
+ "slot_index": 5
402
+ }
403
+ ],
404
+ "outputs": [
405
+ {
406
+ "name": "MODEL",
407
+ "type": "MODEL",
408
+ "links": [
409
+ 37
410
+ ],
411
+ "shape": 3,
412
+ "slot_index": 0
413
+ }
414
+ ],
415
+ "properties": {
416
+ "Node name for S&R": "IPAdapterAdvanced"
417
+ },
418
+ "widgets_values": [
419
+ 0.7000000000000001,
420
+ "linear",
421
+ "concat",
422
+ 0,
423
+ 1
424
+ ]
425
+ },
426
+ {
427
+ "id": 20,
428
+ "type": "PrepImageForClipVision",
429
+ "pos": [
430
+ 775,
431
+ 347
432
+ ],
433
+ "size": [
434
+ 210,
435
+ 106
436
+ ],
437
+ "flags": {},
438
+ "order": 8,
439
+ "mode": 0,
440
+ "inputs": [
441
+ {
442
+ "name": "image",
443
+ "type": "IMAGE",
444
+ "link": 35
445
+ }
446
+ ],
447
+ "outputs": [
448
+ {
449
+ "name": "IMAGE",
450
+ "type": "IMAGE",
451
+ "links": [
452
+ 36,
453
+ 46
454
+ ],
455
+ "shape": 3,
456
+ "slot_index": 0
457
+ }
458
+ ],
459
+ "properties": {
460
+ "Node name for S&R": "PrepImageForClipVision"
461
+ },
462
+ "widgets_values": [
463
+ "LANCZOS",
464
+ "top",
465
+ 0
466
+ ]
467
+ },
468
+ {
469
+ "id": 21,
470
+ "type": "KSampler",
471
+ "pos": [
472
+ 2190,
473
+ 330
474
+ ],
475
+ "size": {
476
+ "0": 315,
477
+ "1": 262
478
+ },
479
+ "flags": {},
480
+ "order": 12,
481
+ "mode": 0,
482
+ "inputs": [
483
+ {
484
+ "name": "model",
485
+ "type": "MODEL",
486
+ "link": 37
487
+ },
488
+ {
489
+ "name": "positive",
490
+ "type": "CONDITIONING",
491
+ "link": 38
492
+ },
493
+ {
494
+ "name": "negative",
495
+ "type": "CONDITIONING",
496
+ "link": 39
497
+ },
498
+ {
499
+ "name": "latent_image",
500
+ "type": "LATENT",
501
+ "link": 40
502
+ }
503
+ ],
504
+ "outputs": [
505
+ {
506
+ "name": "LATENT",
507
+ "type": "LATENT",
508
+ "links": [
509
+ 41
510
+ ],
511
+ "slot_index": 0
512
+ }
513
+ ],
514
+ "properties": {
515
+ "Node name for S&R": "KSampler"
516
+ },
517
+ "widgets_values": [
518
+ 0,
519
+ "fixed",
520
+ 30,
521
+ 6.5,
522
+ "dpmpp_2m_sde_gpu",
523
+ "exponential",
524
+ 1
525
+ ]
526
+ },
527
+ {
528
+ "id": 14,
529
+ "type": "IPAdapterAdvanced",
530
+ "pos": [
531
+ 1199,
532
+ 346
533
+ ],
534
+ "size": {
535
+ "0": 315,
536
+ "1": 254
537
+ },
538
+ "flags": {},
539
+ "order": 9,
540
+ "mode": 0,
541
+ "inputs": [
542
+ {
543
+ "name": "model",
544
+ "type": "MODEL",
545
+ "link": 20
546
+ },
547
+ {
548
+ "name": "ipadapter",
549
+ "type": "IPADAPTER",
550
+ "link": 33,
551
+ "slot_index": 1
552
+ },
553
+ {
554
+ "name": "image",
555
+ "type": "IMAGE",
556
+ "link": 36
557
+ },
558
+ {
559
+ "name": "image_negative",
560
+ "type": "IMAGE",
561
+ "link": null
562
+ },
563
+ {
564
+ "name": "attn_mask",
565
+ "type": "MASK",
566
+ "link": null
567
+ },
568
+ {
569
+ "name": "clip_vision",
570
+ "type": "CLIP_VISION",
571
+ "link": 24,
572
+ "slot_index": 5
573
+ }
574
+ ],
575
+ "outputs": [
576
+ {
577
+ "name": "MODEL",
578
+ "type": "MODEL",
579
+ "links": [
580
+ 23
581
+ ],
582
+ "shape": 3,
583
+ "slot_index": 0
584
+ }
585
+ ],
586
+ "properties": {
587
+ "Node name for S&R": "IPAdapterAdvanced"
588
+ },
589
+ "widgets_values": [
590
+ 0.7000000000000001,
591
+ "linear",
592
+ "concat",
593
+ 0,
594
+ 1
595
+ ]
596
+ },
597
+ {
598
+ "id": 23,
599
+ "type": "SaveImage",
600
+ "pos": [
601
+ 2333,
602
+ 711
603
+ ],
604
+ "size": {
605
+ "0": 529.7760009765625,
606
+ "1": 582.3048095703125
607
+ },
608
+ "flags": {},
609
+ "order": 16,
610
+ "mode": 0,
611
+ "inputs": [
612
+ {
613
+ "name": "images",
614
+ "type": "IMAGE",
615
+ "link": 43
616
+ }
617
+ ],
618
+ "properties": {},
619
+ "widgets_values": [
620
+ "IPAdapter"
621
+ ]
622
+ },
623
+ {
624
+ "id": 19,
625
+ "type": "LoadImage",
626
+ "pos": [
627
+ 1206,
628
+ -41
629
+ ],
630
+ "size": {
631
+ "0": 315,
632
+ "1": 314
633
+ },
634
+ "flags": {},
635
+ "order": 4,
636
+ "mode": 0,
637
+ "outputs": [
638
+ {
639
+ "name": "IMAGE",
640
+ "type": "IMAGE",
641
+ "links": [
642
+ 49
643
+ ],
644
+ "shape": 3,
645
+ "slot_index": 0
646
+ },
647
+ {
648
+ "name": "MASK",
649
+ "type": "MASK",
650
+ "links": null,
651
+ "shape": 3
652
+ }
653
+ ],
654
+ "properties": {
655
+ "Node name for S&R": "LoadImage"
656
+ },
657
+ "widgets_values": [
658
+ "trees.jpg",
659
+ "image"
660
+ ]
661
+ },
662
+ {
663
+ "id": 12,
664
+ "type": "LoadImage",
665
+ "pos": [
666
+ 313,
667
+ 291
668
+ ],
669
+ "size": {
670
+ "0": 315,
671
+ "1": 314
672
+ },
673
+ "flags": {},
674
+ "order": 5,
675
+ "mode": 0,
676
+ "outputs": [
677
+ {
678
+ "name": "IMAGE",
679
+ "type": "IMAGE",
680
+ "links": [
681
+ 35
682
+ ],
683
+ "shape": 3,
684
+ "slot_index": 0
685
+ },
686
+ {
687
+ "name": "MASK",
688
+ "type": "MASK",
689
+ "links": null,
690
+ "shape": 3
691
+ }
692
+ ],
693
+ "properties": {
694
+ "Node name for S&R": "LoadImage"
695
+ },
696
+ "widgets_values": [
697
+ "castle.jpg",
698
+ "image"
699
+ ]
700
+ },
701
+ {
702
+ "id": 22,
703
+ "type": "VAEDecode",
704
+ "pos": [
705
+ 2581,
706
+ 331
707
+ ],
708
+ "size": {
709
+ "0": 140,
710
+ "1": 46
711
+ },
712
+ "flags": {},
713
+ "order": 14,
714
+ "mode": 0,
715
+ "inputs": [
716
+ {
717
+ "name": "samples",
718
+ "type": "LATENT",
719
+ "link": 41
720
+ },
721
+ {
722
+ "name": "vae",
723
+ "type": "VAE",
724
+ "link": 42
725
+ }
726
+ ],
727
+ "outputs": [
728
+ {
729
+ "name": "IMAGE",
730
+ "type": "IMAGE",
731
+ "links": [
732
+ 43
733
+ ],
734
+ "slot_index": 0
735
+ }
736
+ ],
737
+ "properties": {
738
+ "Node name for S&R": "VAEDecode"
739
+ }
740
+ }
741
+ ],
742
+ "links": [
743
+ [
744
+ 2,
745
+ 5,
746
+ 0,
747
+ 3,
748
+ 3,
749
+ "LATENT"
750
+ ],
751
+ [
752
+ 3,
753
+ 4,
754
+ 1,
755
+ 6,
756
+ 0,
757
+ "CLIP"
758
+ ],
759
+ [
760
+ 4,
761
+ 6,
762
+ 0,
763
+ 3,
764
+ 1,
765
+ "CONDITIONING"
766
+ ],
767
+ [
768
+ 5,
769
+ 4,
770
+ 1,
771
+ 7,
772
+ 0,
773
+ "CLIP"
774
+ ],
775
+ [
776
+ 6,
777
+ 7,
778
+ 0,
779
+ 3,
780
+ 2,
781
+ "CONDITIONING"
782
+ ],
783
+ [
784
+ 7,
785
+ 3,
786
+ 0,
787
+ 8,
788
+ 0,
789
+ "LATENT"
790
+ ],
791
+ [
792
+ 8,
793
+ 4,
794
+ 2,
795
+ 8,
796
+ 1,
797
+ "VAE"
798
+ ],
799
+ [
800
+ 9,
801
+ 8,
802
+ 0,
803
+ 9,
804
+ 0,
805
+ "IMAGE"
806
+ ],
807
+ [
808
+ 20,
809
+ 4,
810
+ 0,
811
+ 14,
812
+ 0,
813
+ "MODEL"
814
+ ],
815
+ [
816
+ 23,
817
+ 14,
818
+ 0,
819
+ 3,
820
+ 0,
821
+ "MODEL"
822
+ ],
823
+ [
824
+ 24,
825
+ 16,
826
+ 0,
827
+ 14,
828
+ 5,
829
+ "CLIP_VISION"
830
+ ],
831
+ [
832
+ 33,
833
+ 15,
834
+ 0,
835
+ 14,
836
+ 1,
837
+ "IPADAPTER"
838
+ ],
839
+ [
840
+ 35,
841
+ 12,
842
+ 0,
843
+ 20,
844
+ 0,
845
+ "IMAGE"
846
+ ],
847
+ [
848
+ 36,
849
+ 20,
850
+ 0,
851
+ 14,
852
+ 2,
853
+ "IMAGE"
854
+ ],
855
+ [
856
+ 37,
857
+ 24,
858
+ 0,
859
+ 21,
860
+ 0,
861
+ "MODEL"
862
+ ],
863
+ [
864
+ 38,
865
+ 6,
866
+ 0,
867
+ 21,
868
+ 1,
869
+ "CONDITIONING"
870
+ ],
871
+ [
872
+ 39,
873
+ 7,
874
+ 0,
875
+ 21,
876
+ 2,
877
+ "CONDITIONING"
878
+ ],
879
+ [
880
+ 40,
881
+ 5,
882
+ 0,
883
+ 21,
884
+ 3,
885
+ "LATENT"
886
+ ],
887
+ [
888
+ 41,
889
+ 21,
890
+ 0,
891
+ 22,
892
+ 0,
893
+ "LATENT"
894
+ ],
895
+ [
896
+ 42,
897
+ 4,
898
+ 2,
899
+ 22,
900
+ 1,
901
+ "VAE"
902
+ ],
903
+ [
904
+ 43,
905
+ 22,
906
+ 0,
907
+ 23,
908
+ 0,
909
+ "IMAGE"
910
+ ],
911
+ [
912
+ 44,
913
+ 4,
914
+ 0,
915
+ 24,
916
+ 0,
917
+ "MODEL"
918
+ ],
919
+ [
920
+ 45,
921
+ 15,
922
+ 0,
923
+ 24,
924
+ 1,
925
+ "IPADAPTER"
926
+ ],
927
+ [
928
+ 46,
929
+ 20,
930
+ 0,
931
+ 24,
932
+ 2,
933
+ "IMAGE"
934
+ ],
935
+ [
936
+ 48,
937
+ 16,
938
+ 0,
939
+ 24,
940
+ 5,
941
+ "CLIP_VISION"
942
+ ],
943
+ [
944
+ 49,
945
+ 19,
946
+ 0,
947
+ 24,
948
+ 3,
949
+ "IMAGE"
950
+ ]
951
+ ],
952
+ "groups": [],
953
+ "config": {},
954
+ "extra": {},
955
+ "version": 0.4
956
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_noise_injection.json ADDED
@@ -0,0 +1,677 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 18,
3
+ "last_link_id": 30,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ 50,
10
+ 730
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 20
25
+ ],
26
+ "slot_index": 0
27
+ },
28
+ {
29
+ "name": "CLIP",
30
+ "type": "CLIP",
31
+ "links": [
32
+ 3,
33
+ 5
34
+ ],
35
+ "slot_index": 1
36
+ },
37
+ {
38
+ "name": "VAE",
39
+ "type": "VAE",
40
+ "links": [
41
+ 8
42
+ ],
43
+ "slot_index": 2
44
+ }
45
+ ],
46
+ "properties": {
47
+ "Node name for S&R": "CheckpointLoaderSimple"
48
+ },
49
+ "widgets_values": [
50
+ "sd15/realisticVisionV51_v51VAE.safetensors"
51
+ ]
52
+ },
53
+ {
54
+ "id": 9,
55
+ "type": "SaveImage",
56
+ "pos": [
57
+ 1770,
58
+ 710
59
+ ],
60
+ "size": {
61
+ "0": 529.7760009765625,
62
+ "1": 582.3048095703125
63
+ },
64
+ "flags": {},
65
+ "order": 12,
66
+ "mode": 0,
67
+ "inputs": [
68
+ {
69
+ "name": "images",
70
+ "type": "IMAGE",
71
+ "link": 9
72
+ }
73
+ ],
74
+ "properties": {},
75
+ "widgets_values": [
76
+ "IPAdapter"
77
+ ]
78
+ },
79
+ {
80
+ "id": 7,
81
+ "type": "CLIPTextEncode",
82
+ "pos": [
83
+ 690,
84
+ 840
85
+ ],
86
+ "size": {
87
+ "0": 425.27801513671875,
88
+ "1": 180.6060791015625
89
+ },
90
+ "flags": {},
91
+ "order": 6,
92
+ "mode": 0,
93
+ "inputs": [
94
+ {
95
+ "name": "clip",
96
+ "type": "CLIP",
97
+ "link": 5
98
+ }
99
+ ],
100
+ "outputs": [
101
+ {
102
+ "name": "CONDITIONING",
103
+ "type": "CONDITIONING",
104
+ "links": [
105
+ 6
106
+ ],
107
+ "slot_index": 0
108
+ }
109
+ ],
110
+ "properties": {
111
+ "Node name for S&R": "CLIPTextEncode"
112
+ },
113
+ "widgets_values": [
114
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
115
+ ]
116
+ },
117
+ {
118
+ "id": 5,
119
+ "type": "EmptyLatentImage",
120
+ "pos": [
121
+ 801,
122
+ 1097
123
+ ],
124
+ "size": {
125
+ "0": 315,
126
+ "1": 106
127
+ },
128
+ "flags": {},
129
+ "order": 1,
130
+ "mode": 0,
131
+ "outputs": [
132
+ {
133
+ "name": "LATENT",
134
+ "type": "LATENT",
135
+ "links": [
136
+ 2
137
+ ],
138
+ "slot_index": 0
139
+ }
140
+ ],
141
+ "properties": {
142
+ "Node name for S&R": "EmptyLatentImage"
143
+ },
144
+ "widgets_values": [
145
+ 512,
146
+ 512,
147
+ 1
148
+ ]
149
+ },
150
+ {
151
+ "id": 15,
152
+ "type": "IPAdapterModelLoader",
153
+ "pos": [
154
+ 308,
155
+ 52
156
+ ],
157
+ "size": {
158
+ "0": 315,
159
+ "1": 58
160
+ },
161
+ "flags": {},
162
+ "order": 2,
163
+ "mode": 0,
164
+ "outputs": [
165
+ {
166
+ "name": "IPADAPTER",
167
+ "type": "IPADAPTER",
168
+ "links": [
169
+ 21
170
+ ],
171
+ "shape": 3
172
+ }
173
+ ],
174
+ "properties": {
175
+ "Node name for S&R": "IPAdapterModelLoader"
176
+ },
177
+ "widgets_values": [
178
+ "ip-adapter-plus_sd15.safetensors"
179
+ ]
180
+ },
181
+ {
182
+ "id": 6,
183
+ "type": "CLIPTextEncode",
184
+ "pos": [
185
+ 690,
186
+ 610
187
+ ],
188
+ "size": {
189
+ "0": 422.84503173828125,
190
+ "1": 164.31304931640625
191
+ },
192
+ "flags": {},
193
+ "order": 5,
194
+ "mode": 0,
195
+ "inputs": [
196
+ {
197
+ "name": "clip",
198
+ "type": "CLIP",
199
+ "link": 3
200
+ }
201
+ ],
202
+ "outputs": [
203
+ {
204
+ "name": "CONDITIONING",
205
+ "type": "CONDITIONING",
206
+ "links": [
207
+ 4
208
+ ],
209
+ "slot_index": 0
210
+ }
211
+ ],
212
+ "properties": {
213
+ "Node name for S&R": "CLIPTextEncode"
214
+ },
215
+ "widgets_values": [
216
+ "in a peaceful spring morning a woman wearing a white shirt is sitting in a park on a bench\n\nhigh quality, detailed, diffuse light"
217
+ ]
218
+ },
219
+ {
220
+ "id": 12,
221
+ "type": "LoadImage",
222
+ "pos": [
223
+ 311,
224
+ 270
225
+ ],
226
+ "size": {
227
+ "0": 315,
228
+ "1": 314
229
+ },
230
+ "flags": {},
231
+ "order": 3,
232
+ "mode": 0,
233
+ "outputs": [
234
+ {
235
+ "name": "IMAGE",
236
+ "type": "IMAGE",
237
+ "links": [
238
+ 25
239
+ ],
240
+ "shape": 3,
241
+ "slot_index": 0
242
+ },
243
+ {
244
+ "name": "MASK",
245
+ "type": "MASK",
246
+ "links": null,
247
+ "shape": 3
248
+ }
249
+ ],
250
+ "properties": {
251
+ "Node name for S&R": "LoadImage"
252
+ },
253
+ "widgets_values": [
254
+ "girl_sitting.png",
255
+ "image"
256
+ ]
257
+ },
258
+ {
259
+ "id": 17,
260
+ "type": "PrepImageForClipVision",
261
+ "pos": [
262
+ 728,
263
+ 290
264
+ ],
265
+ "size": {
266
+ "0": 210,
267
+ "1": 106
268
+ },
269
+ "flags": {},
270
+ "order": 7,
271
+ "mode": 0,
272
+ "inputs": [
273
+ {
274
+ "name": "image",
275
+ "type": "IMAGE",
276
+ "link": 25
277
+ }
278
+ ],
279
+ "outputs": [
280
+ {
281
+ "name": "IMAGE",
282
+ "type": "IMAGE",
283
+ "links": [
284
+ 26,
285
+ 29
286
+ ],
287
+ "shape": 3,
288
+ "slot_index": 0
289
+ }
290
+ ],
291
+ "properties": {
292
+ "Node name for S&R": "PrepImageForClipVision"
293
+ },
294
+ "widgets_values": [
295
+ "LANCZOS",
296
+ "top",
297
+ 0.15
298
+ ]
299
+ },
300
+ {
301
+ "id": 14,
302
+ "type": "IPAdapterAdvanced",
303
+ "pos": [
304
+ 1351,
305
+ 214
306
+ ],
307
+ "size": {
308
+ "0": 315,
309
+ "1": 278
310
+ },
311
+ "flags": {},
312
+ "order": 9,
313
+ "mode": 0,
314
+ "inputs": [
315
+ {
316
+ "name": "model",
317
+ "type": "MODEL",
318
+ "link": 20
319
+ },
320
+ {
321
+ "name": "ipadapter",
322
+ "type": "IPADAPTER",
323
+ "link": 21,
324
+ "slot_index": 1
325
+ },
326
+ {
327
+ "name": "image",
328
+ "type": "IMAGE",
329
+ "link": 26
330
+ },
331
+ {
332
+ "name": "image_negative",
333
+ "type": "IMAGE",
334
+ "link": 30
335
+ },
336
+ {
337
+ "name": "attn_mask",
338
+ "type": "MASK",
339
+ "link": null
340
+ },
341
+ {
342
+ "name": "clip_vision",
343
+ "type": "CLIP_VISION",
344
+ "link": 24,
345
+ "slot_index": 5
346
+ }
347
+ ],
348
+ "outputs": [
349
+ {
350
+ "name": "MODEL",
351
+ "type": "MODEL",
352
+ "links": [
353
+ 23
354
+ ],
355
+ "shape": 3,
356
+ "slot_index": 0
357
+ }
358
+ ],
359
+ "properties": {
360
+ "Node name for S&R": "IPAdapterAdvanced"
361
+ },
362
+ "widgets_values": [
363
+ 0.7000000000000001,
364
+ "linear",
365
+ "concat",
366
+ 0,
367
+ 1,
368
+ "V only"
369
+ ]
370
+ },
371
+ {
372
+ "id": 3,
373
+ "type": "KSampler",
374
+ "pos": [
375
+ 1210,
376
+ 700
377
+ ],
378
+ "size": {
379
+ "0": 315,
380
+ "1": 262
381
+ },
382
+ "flags": {},
383
+ "order": 10,
384
+ "mode": 0,
385
+ "inputs": [
386
+ {
387
+ "name": "model",
388
+ "type": "MODEL",
389
+ "link": 23
390
+ },
391
+ {
392
+ "name": "positive",
393
+ "type": "CONDITIONING",
394
+ "link": 4
395
+ },
396
+ {
397
+ "name": "negative",
398
+ "type": "CONDITIONING",
399
+ "link": 6
400
+ },
401
+ {
402
+ "name": "latent_image",
403
+ "type": "LATENT",
404
+ "link": 2
405
+ }
406
+ ],
407
+ "outputs": [
408
+ {
409
+ "name": "LATENT",
410
+ "type": "LATENT",
411
+ "links": [
412
+ 7
413
+ ],
414
+ "slot_index": 0
415
+ }
416
+ ],
417
+ "properties": {
418
+ "Node name for S&R": "KSampler"
419
+ },
420
+ "widgets_values": [
421
+ 0,
422
+ "fixed",
423
+ 30,
424
+ 6.5,
425
+ "dpmpp_2m_sde_gpu",
426
+ "exponential",
427
+ 1
428
+ ]
429
+ },
430
+ {
431
+ "id": 18,
432
+ "type": "IPAdapterNoise",
433
+ "pos": [
434
+ 1019,
435
+ 405
436
+ ],
437
+ "size": {
438
+ "0": 210,
439
+ "1": 106
440
+ },
441
+ "flags": {},
442
+ "order": 8,
443
+ "mode": 0,
444
+ "inputs": [
445
+ {
446
+ "name": "image_optional",
447
+ "type": "IMAGE",
448
+ "link": 29
449
+ }
450
+ ],
451
+ "outputs": [
452
+ {
453
+ "name": "IMAGE",
454
+ "type": "IMAGE",
455
+ "links": [
456
+ 30
457
+ ],
458
+ "shape": 3,
459
+ "slot_index": 0
460
+ }
461
+ ],
462
+ "properties": {
463
+ "Node name for S&R": "IPAdapterNoise"
464
+ },
465
+ "widgets_values": [
466
+ "fade",
467
+ 0.3,
468
+ 5
469
+ ]
470
+ },
471
+ {
472
+ "id": 8,
473
+ "type": "VAEDecode",
474
+ "pos": [
475
+ 1575,
476
+ 705
477
+ ],
478
+ "size": {
479
+ "0": 140,
480
+ "1": 46
481
+ },
482
+ "flags": {},
483
+ "order": 11,
484
+ "mode": 0,
485
+ "inputs": [
486
+ {
487
+ "name": "samples",
488
+ "type": "LATENT",
489
+ "link": 7
490
+ },
491
+ {
492
+ "name": "vae",
493
+ "type": "VAE",
494
+ "link": 8
495
+ }
496
+ ],
497
+ "outputs": [
498
+ {
499
+ "name": "IMAGE",
500
+ "type": "IMAGE",
501
+ "links": [
502
+ 9
503
+ ],
504
+ "slot_index": 0
505
+ }
506
+ ],
507
+ "properties": {
508
+ "Node name for S&R": "VAEDecode"
509
+ }
510
+ },
511
+ {
512
+ "id": 16,
513
+ "type": "CLIPVisionLoader",
514
+ "pos": [
515
+ 308,
516
+ 161
517
+ ],
518
+ "size": {
519
+ "0": 315,
520
+ "1": 58
521
+ },
522
+ "flags": {},
523
+ "order": 4,
524
+ "mode": 0,
525
+ "outputs": [
526
+ {
527
+ "name": "CLIP_VISION",
528
+ "type": "CLIP_VISION",
529
+ "links": [
530
+ 24
531
+ ],
532
+ "shape": 3
533
+ }
534
+ ],
535
+ "properties": {
536
+ "Node name for S&R": "CLIPVisionLoader"
537
+ },
538
+ "widgets_values": [
539
+ "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors"
540
+ ]
541
+ }
542
+ ],
543
+ "links": [
544
+ [
545
+ 2,
546
+ 5,
547
+ 0,
548
+ 3,
549
+ 3,
550
+ "LATENT"
551
+ ],
552
+ [
553
+ 3,
554
+ 4,
555
+ 1,
556
+ 6,
557
+ 0,
558
+ "CLIP"
559
+ ],
560
+ [
561
+ 4,
562
+ 6,
563
+ 0,
564
+ 3,
565
+ 1,
566
+ "CONDITIONING"
567
+ ],
568
+ [
569
+ 5,
570
+ 4,
571
+ 1,
572
+ 7,
573
+ 0,
574
+ "CLIP"
575
+ ],
576
+ [
577
+ 6,
578
+ 7,
579
+ 0,
580
+ 3,
581
+ 2,
582
+ "CONDITIONING"
583
+ ],
584
+ [
585
+ 7,
586
+ 3,
587
+ 0,
588
+ 8,
589
+ 0,
590
+ "LATENT"
591
+ ],
592
+ [
593
+ 8,
594
+ 4,
595
+ 2,
596
+ 8,
597
+ 1,
598
+ "VAE"
599
+ ],
600
+ [
601
+ 9,
602
+ 8,
603
+ 0,
604
+ 9,
605
+ 0,
606
+ "IMAGE"
607
+ ],
608
+ [
609
+ 20,
610
+ 4,
611
+ 0,
612
+ 14,
613
+ 0,
614
+ "MODEL"
615
+ ],
616
+ [
617
+ 21,
618
+ 15,
619
+ 0,
620
+ 14,
621
+ 1,
622
+ "IPADAPTER"
623
+ ],
624
+ [
625
+ 23,
626
+ 14,
627
+ 0,
628
+ 3,
629
+ 0,
630
+ "MODEL"
631
+ ],
632
+ [
633
+ 24,
634
+ 16,
635
+ 0,
636
+ 14,
637
+ 5,
638
+ "CLIP_VISION"
639
+ ],
640
+ [
641
+ 25,
642
+ 12,
643
+ 0,
644
+ 17,
645
+ 0,
646
+ "IMAGE"
647
+ ],
648
+ [
649
+ 26,
650
+ 17,
651
+ 0,
652
+ 14,
653
+ 2,
654
+ "IMAGE"
655
+ ],
656
+ [
657
+ 29,
658
+ 17,
659
+ 0,
660
+ 18,
661
+ 0,
662
+ "IMAGE"
663
+ ],
664
+ [
665
+ 30,
666
+ 18,
667
+ 0,
668
+ 14,
669
+ 3,
670
+ "IMAGE"
671
+ ]
672
+ ],
673
+ "groups": [],
674
+ "config": {},
675
+ "extra": {},
676
+ "version": 0.4
677
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_portrait.json ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 20,
3
+ "last_link_id": 36,
4
+ "nodes": [
5
+ {
6
+ "id": 8,
7
+ "type": "VAEDecode",
8
+ "pos": [
9
+ 1640,
10
+ 710
11
+ ],
12
+ "size": {
13
+ "0": 140,
14
+ "1": 46
15
+ },
16
+ "flags": {},
17
+ "order": 8,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "samples",
22
+ "type": "LATENT",
23
+ "link": 7
24
+ },
25
+ {
26
+ "name": "vae",
27
+ "type": "VAE",
28
+ "link": 8
29
+ }
30
+ ],
31
+ "outputs": [
32
+ {
33
+ "name": "IMAGE",
34
+ "type": "IMAGE",
35
+ "links": [
36
+ 9
37
+ ],
38
+ "slot_index": 0
39
+ }
40
+ ],
41
+ "properties": {
42
+ "Node name for S&R": "VAEDecode"
43
+ }
44
+ },
45
+ {
46
+ "id": 3,
47
+ "type": "KSampler",
48
+ "pos": [
49
+ 1280,
50
+ 710
51
+ ],
52
+ "size": {
53
+ "0": 315,
54
+ "1": 262
55
+ },
56
+ "flags": {},
57
+ "order": 7,
58
+ "mode": 0,
59
+ "inputs": [
60
+ {
61
+ "name": "model",
62
+ "type": "MODEL",
63
+ "link": 32
64
+ },
65
+ {
66
+ "name": "positive",
67
+ "type": "CONDITIONING",
68
+ "link": 4
69
+ },
70
+ {
71
+ "name": "negative",
72
+ "type": "CONDITIONING",
73
+ "link": 6
74
+ },
75
+ {
76
+ "name": "latent_image",
77
+ "type": "LATENT",
78
+ "link": 2
79
+ }
80
+ ],
81
+ "outputs": [
82
+ {
83
+ "name": "LATENT",
84
+ "type": "LATENT",
85
+ "links": [
86
+ 7
87
+ ],
88
+ "slot_index": 0
89
+ }
90
+ ],
91
+ "properties": {
92
+ "Node name for S&R": "KSampler"
93
+ },
94
+ "widgets_values": [
95
+ 0,
96
+ "fixed",
97
+ 30,
98
+ 6.5,
99
+ "ddpm",
100
+ "karras",
101
+ 1
102
+ ]
103
+ },
104
+ {
105
+ "id": 9,
106
+ "type": "SaveImage",
107
+ "pos": [
108
+ 1830,
109
+ 700
110
+ ],
111
+ "size": {
112
+ "0": 529.7760009765625,
113
+ "1": 582.3048095703125
114
+ },
115
+ "flags": {},
116
+ "order": 9,
117
+ "mode": 0,
118
+ "inputs": [
119
+ {
120
+ "name": "images",
121
+ "type": "IMAGE",
122
+ "link": 9
123
+ }
124
+ ],
125
+ "properties": {},
126
+ "widgets_values": [
127
+ "IPAdapter"
128
+ ]
129
+ },
130
+ {
131
+ "id": 20,
132
+ "type": "IPAdapterUnifiedLoaderFaceID",
133
+ "pos": [
134
+ 460,
135
+ 60
136
+ ],
137
+ "size": {
138
+ "0": 315,
139
+ "1": 126
140
+ },
141
+ "flags": {},
142
+ "order": 3,
143
+ "mode": 0,
144
+ "inputs": [
145
+ {
146
+ "name": "model",
147
+ "type": "MODEL",
148
+ "link": 36
149
+ },
150
+ {
151
+ "name": "ipadapter",
152
+ "type": "IPADAPTER",
153
+ "link": null
154
+ }
155
+ ],
156
+ "outputs": [
157
+ {
158
+ "name": "MODEL",
159
+ "type": "MODEL",
160
+ "links": [
161
+ 35
162
+ ],
163
+ "shape": 3,
164
+ "slot_index": 0
165
+ },
166
+ {
167
+ "name": "ipadapter",
168
+ "type": "IPADAPTER",
169
+ "links": [
170
+ 34
171
+ ],
172
+ "shape": 3
173
+ }
174
+ ],
175
+ "properties": {
176
+ "Node name for S&R": "IPAdapterUnifiedLoaderFaceID"
177
+ },
178
+ "widgets_values": [
179
+ "FACEID PORTRAIT (style transfer)",
180
+ 0.6,
181
+ "CPU"
182
+ ]
183
+ },
184
+ {
185
+ "id": 4,
186
+ "type": "CheckpointLoaderSimple",
187
+ "pos": [
188
+ 10,
189
+ 680
190
+ ],
191
+ "size": {
192
+ "0": 315,
193
+ "1": 98
194
+ },
195
+ "flags": {},
196
+ "order": 0,
197
+ "mode": 0,
198
+ "outputs": [
199
+ {
200
+ "name": "MODEL",
201
+ "type": "MODEL",
202
+ "links": [
203
+ 36
204
+ ],
205
+ "slot_index": 0
206
+ },
207
+ {
208
+ "name": "CLIP",
209
+ "type": "CLIP",
210
+ "links": [
211
+ 3,
212
+ 5
213
+ ],
214
+ "slot_index": 1
215
+ },
216
+ {
217
+ "name": "VAE",
218
+ "type": "VAE",
219
+ "links": [
220
+ 8
221
+ ],
222
+ "slot_index": 2
223
+ }
224
+ ],
225
+ "properties": {
226
+ "Node name for S&R": "CheckpointLoaderSimple"
227
+ },
228
+ "widgets_values": [
229
+ "sdxl/juggernautXL_version8Rundiffusion.safetensors"
230
+ ]
231
+ },
232
+ {
233
+ "id": 5,
234
+ "type": "EmptyLatentImage",
235
+ "pos": [
236
+ 870,
237
+ 1100
238
+ ],
239
+ "size": {
240
+ "0": 315,
241
+ "1": 106
242
+ },
243
+ "flags": {},
244
+ "order": 1,
245
+ "mode": 0,
246
+ "outputs": [
247
+ {
248
+ "name": "LATENT",
249
+ "type": "LATENT",
250
+ "links": [
251
+ 2
252
+ ],
253
+ "slot_index": 0
254
+ }
255
+ ],
256
+ "properties": {
257
+ "Node name for S&R": "EmptyLatentImage"
258
+ },
259
+ "widgets_values": [
260
+ 1024,
261
+ 1024,
262
+ 1
263
+ ]
264
+ },
265
+ {
266
+ "id": 12,
267
+ "type": "LoadImage",
268
+ "pos": [
269
+ 450,
270
+ 240
271
+ ],
272
+ "size": {
273
+ "0": 315,
274
+ "1": 314
275
+ },
276
+ "flags": {},
277
+ "order": 2,
278
+ "mode": 0,
279
+ "outputs": [
280
+ {
281
+ "name": "IMAGE",
282
+ "type": "IMAGE",
283
+ "links": [
284
+ 29
285
+ ],
286
+ "shape": 3,
287
+ "slot_index": 0
288
+ },
289
+ {
290
+ "name": "MASK",
291
+ "type": "MASK",
292
+ "links": null,
293
+ "shape": 3
294
+ }
295
+ ],
296
+ "properties": {
297
+ "Node name for S&R": "LoadImage"
298
+ },
299
+ "widgets_values": [
300
+ "face2.jpg",
301
+ "image"
302
+ ]
303
+ },
304
+ {
305
+ "id": 6,
306
+ "type": "CLIPTextEncode",
307
+ "pos": [
308
+ 760,
309
+ 620
310
+ ],
311
+ "size": {
312
+ "0": 422.84503173828125,
313
+ "1": 164.31304931640625
314
+ },
315
+ "flags": {},
316
+ "order": 4,
317
+ "mode": 0,
318
+ "inputs": [
319
+ {
320
+ "name": "clip",
321
+ "type": "CLIP",
322
+ "link": 3
323
+ }
324
+ ],
325
+ "outputs": [
326
+ {
327
+ "name": "CONDITIONING",
328
+ "type": "CONDITIONING",
329
+ "links": [
330
+ 4
331
+ ],
332
+ "slot_index": 0
333
+ }
334
+ ],
335
+ "properties": {
336
+ "Node name for S&R": "CLIPTextEncode"
337
+ },
338
+ "widgets_values": [
339
+ "a watercolor painting of a woman on the beach\n\nhigh quality artistry"
340
+ ]
341
+ },
342
+ {
343
+ "id": 7,
344
+ "type": "CLIPTextEncode",
345
+ "pos": [
346
+ 760,
347
+ 850
348
+ ],
349
+ "size": {
350
+ "0": 425.27801513671875,
351
+ "1": 180.6060791015625
352
+ },
353
+ "flags": {},
354
+ "order": 5,
355
+ "mode": 0,
356
+ "inputs": [
357
+ {
358
+ "name": "clip",
359
+ "type": "CLIP",
360
+ "link": 5
361
+ }
362
+ ],
363
+ "outputs": [
364
+ {
365
+ "name": "CONDITIONING",
366
+ "type": "CONDITIONING",
367
+ "links": [
368
+ 6
369
+ ],
370
+ "slot_index": 0
371
+ }
372
+ ],
373
+ "properties": {
374
+ "Node name for S&R": "CLIPTextEncode"
375
+ },
376
+ "widgets_values": [
377
+ "photo, blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed, naked"
378
+ ]
379
+ },
380
+ {
381
+ "id": 18,
382
+ "type": "IPAdapterFaceID",
383
+ "pos": [
384
+ 850,
385
+ 190
386
+ ],
387
+ "size": {
388
+ "0": 315,
389
+ "1": 322
390
+ },
391
+ "flags": {},
392
+ "order": 6,
393
+ "mode": 0,
394
+ "inputs": [
395
+ {
396
+ "name": "model",
397
+ "type": "MODEL",
398
+ "link": 35
399
+ },
400
+ {
401
+ "name": "ipadapter",
402
+ "type": "IPADAPTER",
403
+ "link": 34,
404
+ "slot_index": 1
405
+ },
406
+ {
407
+ "name": "image",
408
+ "type": "IMAGE",
409
+ "link": 29
410
+ },
411
+ {
412
+ "name": "image_negative",
413
+ "type": "IMAGE",
414
+ "link": null
415
+ },
416
+ {
417
+ "name": "attn_mask",
418
+ "type": "MASK",
419
+ "link": null
420
+ },
421
+ {
422
+ "name": "clip_vision",
423
+ "type": "CLIP_VISION",
424
+ "link": null
425
+ },
426
+ {
427
+ "name": "insightface",
428
+ "type": "INSIGHTFACE",
429
+ "link": null
430
+ }
431
+ ],
432
+ "outputs": [
433
+ {
434
+ "name": "MODEL",
435
+ "type": "MODEL",
436
+ "links": [
437
+ 32
438
+ ],
439
+ "shape": 3,
440
+ "slot_index": 0
441
+ }
442
+ ],
443
+ "properties": {
444
+ "Node name for S&R": "IPAdapterFaceID"
445
+ },
446
+ "widgets_values": [
447
+ 0.65,
448
+ 1,
449
+ "linear",
450
+ "concat",
451
+ 0,
452
+ 1,
453
+ "V only"
454
+ ]
455
+ }
456
+ ],
457
+ "links": [
458
+ [
459
+ 2,
460
+ 5,
461
+ 0,
462
+ 3,
463
+ 3,
464
+ "LATENT"
465
+ ],
466
+ [
467
+ 3,
468
+ 4,
469
+ 1,
470
+ 6,
471
+ 0,
472
+ "CLIP"
473
+ ],
474
+ [
475
+ 4,
476
+ 6,
477
+ 0,
478
+ 3,
479
+ 1,
480
+ "CONDITIONING"
481
+ ],
482
+ [
483
+ 5,
484
+ 4,
485
+ 1,
486
+ 7,
487
+ 0,
488
+ "CLIP"
489
+ ],
490
+ [
491
+ 6,
492
+ 7,
493
+ 0,
494
+ 3,
495
+ 2,
496
+ "CONDITIONING"
497
+ ],
498
+ [
499
+ 7,
500
+ 3,
501
+ 0,
502
+ 8,
503
+ 0,
504
+ "LATENT"
505
+ ],
506
+ [
507
+ 8,
508
+ 4,
509
+ 2,
510
+ 8,
511
+ 1,
512
+ "VAE"
513
+ ],
514
+ [
515
+ 9,
516
+ 8,
517
+ 0,
518
+ 9,
519
+ 0,
520
+ "IMAGE"
521
+ ],
522
+ [
523
+ 29,
524
+ 12,
525
+ 0,
526
+ 18,
527
+ 2,
528
+ "IMAGE"
529
+ ],
530
+ [
531
+ 32,
532
+ 18,
533
+ 0,
534
+ 3,
535
+ 0,
536
+ "MODEL"
537
+ ],
538
+ [
539
+ 34,
540
+ 20,
541
+ 1,
542
+ 18,
543
+ 1,
544
+ "IPADAPTER"
545
+ ],
546
+ [
547
+ 35,
548
+ 20,
549
+ 0,
550
+ 18,
551
+ 0,
552
+ "MODEL"
553
+ ],
554
+ [
555
+ 36,
556
+ 4,
557
+ 0,
558
+ 20,
559
+ 0,
560
+ "MODEL"
561
+ ]
562
+ ],
563
+ "groups": [],
564
+ "config": {},
565
+ "extra": {},
566
+ "version": 0.4
567
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_precise_composition.json ADDED
@@ -0,0 +1,861 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 19,
3
+ "last_link_id": 34,
4
+ "nodes": [
5
+ {
6
+ "id": 10,
7
+ "type": "PreviewImage",
8
+ "pos": [
9
+ 1730,
10
+ 139
11
+ ],
12
+ "size": {
13
+ "0": 1060.949462890625,
14
+ "1": 1076.0679931640625
15
+ },
16
+ "flags": {},
17
+ "order": 12,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "images",
22
+ "type": "IMAGE",
23
+ "link": 10
24
+ }
25
+ ],
26
+ "properties": {
27
+ "Node name for S&R": "PreviewImage"
28
+ }
29
+ },
30
+ {
31
+ "id": 4,
32
+ "type": "CheckpointLoaderSimple",
33
+ "pos": [
34
+ -491,
35
+ -138
36
+ ],
37
+ "size": {
38
+ "0": 315,
39
+ "1": 98
40
+ },
41
+ "flags": {},
42
+ "order": 0,
43
+ "mode": 0,
44
+ "outputs": [
45
+ {
46
+ "name": "MODEL",
47
+ "type": "MODEL",
48
+ "links": [
49
+ 15
50
+ ],
51
+ "slot_index": 0
52
+ },
53
+ {
54
+ "name": "CLIP",
55
+ "type": "CLIP",
56
+ "links": [
57
+ 3,
58
+ 5
59
+ ],
60
+ "slot_index": 1
61
+ },
62
+ {
63
+ "name": "VAE",
64
+ "type": "VAE",
65
+ "links": [
66
+ 8,
67
+ 30
68
+ ],
69
+ "slot_index": 2
70
+ }
71
+ ],
72
+ "properties": {
73
+ "Node name for S&R": "CheckpointLoaderSimple"
74
+ },
75
+ "widgets_values": [
76
+ "sdxl/ProteusV0.3.safetensors"
77
+ ]
78
+ },
79
+ {
80
+ "id": 13,
81
+ "type": "IPAdapterUnifiedLoader",
82
+ "pos": [
83
+ 237,
84
+ -374
85
+ ],
86
+ "size": {
87
+ "0": 225.859619140625,
88
+ "1": 78
89
+ },
90
+ "flags": {},
91
+ "order": 3,
92
+ "mode": 0,
93
+ "inputs": [
94
+ {
95
+ "name": "model",
96
+ "type": "MODEL",
97
+ "link": 15
98
+ },
99
+ {
100
+ "name": "ipadapter",
101
+ "type": "IPADAPTER",
102
+ "link": null
103
+ }
104
+ ],
105
+ "outputs": [
106
+ {
107
+ "name": "model",
108
+ "type": "MODEL",
109
+ "links": [
110
+ 18,
111
+ 22
112
+ ],
113
+ "shape": 3,
114
+ "slot_index": 0
115
+ },
116
+ {
117
+ "name": "ipadapter",
118
+ "type": "IPADAPTER",
119
+ "links": [
120
+ 19,
121
+ 23
122
+ ],
123
+ "shape": 3,
124
+ "slot_index": 1
125
+ }
126
+ ],
127
+ "properties": {
128
+ "Node name for S&R": "IPAdapterUnifiedLoader"
129
+ },
130
+ "widgets_values": [
131
+ "PLUS (high strength)"
132
+ ]
133
+ },
134
+ {
135
+ "id": 14,
136
+ "type": "LoadImage",
137
+ "pos": [
138
+ 177,
139
+ -764
140
+ ],
141
+ "size": {
142
+ "0": 315,
143
+ "1": 314
144
+ },
145
+ "flags": {},
146
+ "order": 1,
147
+ "mode": 0,
148
+ "outputs": [
149
+ {
150
+ "name": "IMAGE",
151
+ "type": "IMAGE",
152
+ "links": [
153
+ 20,
154
+ 24
155
+ ],
156
+ "shape": 3,
157
+ "slot_index": 0
158
+ },
159
+ {
160
+ "name": "MASK",
161
+ "type": "MASK",
162
+ "links": null,
163
+ "shape": 3
164
+ }
165
+ ],
166
+ "properties": {
167
+ "Node name for S&R": "LoadImage"
168
+ },
169
+ "widgets_values": [
170
+ "anime_illustration.png",
171
+ "image"
172
+ ]
173
+ },
174
+ {
175
+ "id": 3,
176
+ "type": "KSampler",
177
+ "pos": [
178
+ 1198,
179
+ 175
180
+ ],
181
+ "size": {
182
+ "0": 315,
183
+ "1": 262
184
+ },
185
+ "flags": {},
186
+ "order": 8,
187
+ "mode": 0,
188
+ "inputs": [
189
+ {
190
+ "name": "model",
191
+ "type": "MODEL",
192
+ "link": 21
193
+ },
194
+ {
195
+ "name": "positive",
196
+ "type": "CONDITIONING",
197
+ "link": 4
198
+ },
199
+ {
200
+ "name": "negative",
201
+ "type": "CONDITIONING",
202
+ "link": 6
203
+ },
204
+ {
205
+ "name": "latent_image",
206
+ "type": "LATENT",
207
+ "link": 34
208
+ }
209
+ ],
210
+ "outputs": [
211
+ {
212
+ "name": "LATENT",
213
+ "type": "LATENT",
214
+ "links": [
215
+ 7
216
+ ],
217
+ "slot_index": 0
218
+ }
219
+ ],
220
+ "properties": {
221
+ "Node name for S&R": "KSampler"
222
+ },
223
+ "widgets_values": [
224
+ 0,
225
+ "fixed",
226
+ 30,
227
+ 6,
228
+ "dpmpp_2m",
229
+ "karras",
230
+ 1
231
+ ]
232
+ },
233
+ {
234
+ "id": 6,
235
+ "type": "CLIPTextEncode",
236
+ "pos": [
237
+ 121,
238
+ -207
239
+ ],
240
+ "size": {
241
+ "0": 422.84503173828125,
242
+ "1": 164.31304931640625
243
+ },
244
+ "flags": {},
245
+ "order": 4,
246
+ "mode": 0,
247
+ "inputs": [
248
+ {
249
+ "name": "clip",
250
+ "type": "CLIP",
251
+ "link": 3
252
+ }
253
+ ],
254
+ "outputs": [
255
+ {
256
+ "name": "CONDITIONING",
257
+ "type": "CONDITIONING",
258
+ "links": [
259
+ 4,
260
+ 26
261
+ ],
262
+ "slot_index": 0
263
+ }
264
+ ],
265
+ "properties": {
266
+ "Node name for S&R": "CLIPTextEncode"
267
+ },
268
+ "widgets_values": [
269
+ "portrait of the most beautiful anthropomorphic cat, detailed, intricate, furry, 4k, bright"
270
+ ]
271
+ },
272
+ {
273
+ "id": 7,
274
+ "type": "CLIPTextEncode",
275
+ "pos": [
276
+ 125,
277
+ 47
278
+ ],
279
+ "size": {
280
+ "0": 425.27801513671875,
281
+ "1": 180.6060791015625
282
+ },
283
+ "flags": {},
284
+ "order": 5,
285
+ "mode": 0,
286
+ "inputs": [
287
+ {
288
+ "name": "clip",
289
+ "type": "CLIP",
290
+ "link": 5
291
+ }
292
+ ],
293
+ "outputs": [
294
+ {
295
+ "name": "CONDITIONING",
296
+ "type": "CONDITIONING",
297
+ "links": [
298
+ 6,
299
+ 27
300
+ ],
301
+ "slot_index": 0
302
+ }
303
+ ],
304
+ "properties": {
305
+ "Node name for S&R": "CLIPTextEncode"
306
+ },
307
+ "widgets_values": [
308
+ "blurry, glitch, artifact, distorted, malformed, messy, dirty"
309
+ ]
310
+ },
311
+ {
312
+ "id": 18,
313
+ "type": "PreviewImage",
314
+ "pos": [
315
+ 1743,
316
+ -1020
317
+ ],
318
+ "size": {
319
+ "0": 1060.949462890625,
320
+ "1": 1076.0679931640625
321
+ },
322
+ "flags": {},
323
+ "order": 13,
324
+ "mode": 0,
325
+ "inputs": [
326
+ {
327
+ "name": "images",
328
+ "type": "IMAGE",
329
+ "link": 31
330
+ }
331
+ ],
332
+ "properties": {
333
+ "Node name for S&R": "PreviewImage"
334
+ }
335
+ },
336
+ {
337
+ "id": 17,
338
+ "type": "VAEDecode",
339
+ "pos": [
340
+ 1544,
341
+ -1007
342
+ ],
343
+ "size": {
344
+ "0": 140,
345
+ "1": 46
346
+ },
347
+ "flags": {
348
+ "collapsed": true
349
+ },
350
+ "order": 11,
351
+ "mode": 0,
352
+ "inputs": [
353
+ {
354
+ "name": "samples",
355
+ "type": "LATENT",
356
+ "link": 29
357
+ },
358
+ {
359
+ "name": "vae",
360
+ "type": "VAE",
361
+ "link": 30
362
+ }
363
+ ],
364
+ "outputs": [
365
+ {
366
+ "name": "IMAGE",
367
+ "type": "IMAGE",
368
+ "links": [
369
+ 31
370
+ ],
371
+ "slot_index": 0
372
+ }
373
+ ],
374
+ "properties": {
375
+ "Node name for S&R": "VAEDecode"
376
+ }
377
+ },
378
+ {
379
+ "id": 8,
380
+ "type": "VAEDecode",
381
+ "pos": [
382
+ 1551,
383
+ 139
384
+ ],
385
+ "size": {
386
+ "0": 140,
387
+ "1": 46
388
+ },
389
+ "flags": {
390
+ "collapsed": true
391
+ },
392
+ "order": 10,
393
+ "mode": 0,
394
+ "inputs": [
395
+ {
396
+ "name": "samples",
397
+ "type": "LATENT",
398
+ "link": 7
399
+ },
400
+ {
401
+ "name": "vae",
402
+ "type": "VAE",
403
+ "link": 8
404
+ }
405
+ ],
406
+ "outputs": [
407
+ {
408
+ "name": "IMAGE",
409
+ "type": "IMAGE",
410
+ "links": [
411
+ 10
412
+ ],
413
+ "slot_index": 0
414
+ }
415
+ ],
416
+ "properties": {
417
+ "Node name for S&R": "VAEDecode"
418
+ }
419
+ },
420
+ {
421
+ "id": 15,
422
+ "type": "IPAdapterMS",
423
+ "pos": [
424
+ 787,
425
+ 180
426
+ ],
427
+ "size": {
428
+ "0": 319.27130126953125,
429
+ "1": 364
430
+ },
431
+ "flags": {},
432
+ "order": 6,
433
+ "mode": 0,
434
+ "inputs": [
435
+ {
436
+ "name": "model",
437
+ "type": "MODEL",
438
+ "link": 18
439
+ },
440
+ {
441
+ "name": "ipadapter",
442
+ "type": "IPADAPTER",
443
+ "link": 19
444
+ },
445
+ {
446
+ "name": "image",
447
+ "type": "IMAGE",
448
+ "link": 20
449
+ },
450
+ {
451
+ "name": "image_negative",
452
+ "type": "IMAGE",
453
+ "link": null
454
+ },
455
+ {
456
+ "name": "attn_mask",
457
+ "type": "MASK",
458
+ "link": null
459
+ },
460
+ {
461
+ "name": "clip_vision",
462
+ "type": "CLIP_VISION",
463
+ "link": null
464
+ },
465
+ {
466
+ "name": "insightface",
467
+ "type": "INSIGHTFACE",
468
+ "link": null
469
+ }
470
+ ],
471
+ "outputs": [
472
+ {
473
+ "name": "MODEL",
474
+ "type": "MODEL",
475
+ "links": [
476
+ 21
477
+ ],
478
+ "shape": 3,
479
+ "slot_index": 0
480
+ }
481
+ ],
482
+ "properties": {
483
+ "Node name for S&R": "IPAdapterMS"
484
+ },
485
+ "widgets_values": [
486
+ 1,
487
+ 1,
488
+ "composition precise",
489
+ "concat",
490
+ 0,
491
+ 1,
492
+ "K+mean(V) w/ C penalty",
493
+ "0:0, 1:0, 2:0, 3:0.8, 4:0, 5:0, 6:0.35, 7:0, 8:0, 9:0, 10:0"
494
+ ]
495
+ },
496
+ {
497
+ "id": 12,
498
+ "type": "IPAdapterPreciseComposition",
499
+ "pos": [
500
+ 743,
501
+ -902
502
+ ],
503
+ "size": {
504
+ "0": 315,
505
+ "1": 278
506
+ },
507
+ "flags": {},
508
+ "order": 7,
509
+ "mode": 0,
510
+ "inputs": [
511
+ {
512
+ "name": "model",
513
+ "type": "MODEL",
514
+ "link": 22
515
+ },
516
+ {
517
+ "name": "ipadapter",
518
+ "type": "IPADAPTER",
519
+ "link": 23,
520
+ "slot_index": 1
521
+ },
522
+ {
523
+ "name": "image",
524
+ "type": "IMAGE",
525
+ "link": 24,
526
+ "slot_index": 2
527
+ },
528
+ {
529
+ "name": "image_negative",
530
+ "type": "IMAGE",
531
+ "link": null
532
+ },
533
+ {
534
+ "name": "attn_mask",
535
+ "type": "MASK",
536
+ "link": null
537
+ },
538
+ {
539
+ "name": "clip_vision",
540
+ "type": "CLIP_VISION",
541
+ "link": null
542
+ }
543
+ ],
544
+ "outputs": [
545
+ {
546
+ "name": "MODEL",
547
+ "type": "MODEL",
548
+ "links": [
549
+ 32
550
+ ],
551
+ "shape": 3,
552
+ "slot_index": 0
553
+ }
554
+ ],
555
+ "properties": {
556
+ "Node name for S&R": "IPAdapterPreciseComposition"
557
+ },
558
+ "widgets_values": [
559
+ 0.8,
560
+ 0.35000000000000003,
561
+ "concat",
562
+ 0,
563
+ 1,
564
+ "K+mean(V) w/ C penalty"
565
+ ]
566
+ },
567
+ {
568
+ "id": 16,
569
+ "type": "KSampler",
570
+ "pos": [
571
+ 1183,
572
+ -909
573
+ ],
574
+ "size": {
575
+ "0": 315,
576
+ "1": 262
577
+ },
578
+ "flags": {},
579
+ "order": 9,
580
+ "mode": 0,
581
+ "inputs": [
582
+ {
583
+ "name": "model",
584
+ "type": "MODEL",
585
+ "link": 32
586
+ },
587
+ {
588
+ "name": "positive",
589
+ "type": "CONDITIONING",
590
+ "link": 26
591
+ },
592
+ {
593
+ "name": "negative",
594
+ "type": "CONDITIONING",
595
+ "link": 27
596
+ },
597
+ {
598
+ "name": "latent_image",
599
+ "type": "LATENT",
600
+ "link": 33,
601
+ "slot_index": 3
602
+ }
603
+ ],
604
+ "outputs": [
605
+ {
606
+ "name": "LATENT",
607
+ "type": "LATENT",
608
+ "links": [
609
+ 29
610
+ ],
611
+ "slot_index": 0
612
+ }
613
+ ],
614
+ "properties": {
615
+ "Node name for S&R": "KSampler"
616
+ },
617
+ "widgets_values": [
618
+ 0,
619
+ "fixed",
620
+ 30,
621
+ 6,
622
+ "dpmpp_2m",
623
+ "karras",
624
+ 1
625
+ ]
626
+ },
627
+ {
628
+ "id": 19,
629
+ "type": "EmptyLatentImage",
630
+ "pos": [
631
+ 697,
632
+ -303
633
+ ],
634
+ "size": {
635
+ "0": 315,
636
+ "1": 106
637
+ },
638
+ "flags": {},
639
+ "order": 2,
640
+ "mode": 0,
641
+ "outputs": [
642
+ {
643
+ "name": "LATENT",
644
+ "type": "LATENT",
645
+ "links": [
646
+ 33,
647
+ 34
648
+ ],
649
+ "shape": 3,
650
+ "slot_index": 0
651
+ }
652
+ ],
653
+ "properties": {
654
+ "Node name for S&R": "EmptyLatentImage"
655
+ },
656
+ "widgets_values": [
657
+ 1024,
658
+ 1024,
659
+ 1
660
+ ]
661
+ }
662
+ ],
663
+ "links": [
664
+ [
665
+ 3,
666
+ 4,
667
+ 1,
668
+ 6,
669
+ 0,
670
+ "CLIP"
671
+ ],
672
+ [
673
+ 4,
674
+ 6,
675
+ 0,
676
+ 3,
677
+ 1,
678
+ "CONDITIONING"
679
+ ],
680
+ [
681
+ 5,
682
+ 4,
683
+ 1,
684
+ 7,
685
+ 0,
686
+ "CLIP"
687
+ ],
688
+ [
689
+ 6,
690
+ 7,
691
+ 0,
692
+ 3,
693
+ 2,
694
+ "CONDITIONING"
695
+ ],
696
+ [
697
+ 7,
698
+ 3,
699
+ 0,
700
+ 8,
701
+ 0,
702
+ "LATENT"
703
+ ],
704
+ [
705
+ 8,
706
+ 4,
707
+ 2,
708
+ 8,
709
+ 1,
710
+ "VAE"
711
+ ],
712
+ [
713
+ 10,
714
+ 8,
715
+ 0,
716
+ 10,
717
+ 0,
718
+ "IMAGE"
719
+ ],
720
+ [
721
+ 15,
722
+ 4,
723
+ 0,
724
+ 13,
725
+ 0,
726
+ "MODEL"
727
+ ],
728
+ [
729
+ 18,
730
+ 13,
731
+ 0,
732
+ 15,
733
+ 0,
734
+ "MODEL"
735
+ ],
736
+ [
737
+ 19,
738
+ 13,
739
+ 1,
740
+ 15,
741
+ 1,
742
+ "IPADAPTER"
743
+ ],
744
+ [
745
+ 20,
746
+ 14,
747
+ 0,
748
+ 15,
749
+ 2,
750
+ "IMAGE"
751
+ ],
752
+ [
753
+ 21,
754
+ 15,
755
+ 0,
756
+ 3,
757
+ 0,
758
+ "MODEL"
759
+ ],
760
+ [
761
+ 22,
762
+ 13,
763
+ 0,
764
+ 12,
765
+ 0,
766
+ "MODEL"
767
+ ],
768
+ [
769
+ 23,
770
+ 13,
771
+ 1,
772
+ 12,
773
+ 1,
774
+ "IPADAPTER"
775
+ ],
776
+ [
777
+ 24,
778
+ 14,
779
+ 0,
780
+ 12,
781
+ 2,
782
+ "IMAGE"
783
+ ],
784
+ [
785
+ 26,
786
+ 6,
787
+ 0,
788
+ 16,
789
+ 1,
790
+ "CONDITIONING"
791
+ ],
792
+ [
793
+ 27,
794
+ 7,
795
+ 0,
796
+ 16,
797
+ 2,
798
+ "CONDITIONING"
799
+ ],
800
+ [
801
+ 29,
802
+ 16,
803
+ 0,
804
+ 17,
805
+ 0,
806
+ "LATENT"
807
+ ],
808
+ [
809
+ 30,
810
+ 4,
811
+ 2,
812
+ 17,
813
+ 1,
814
+ "VAE"
815
+ ],
816
+ [
817
+ 31,
818
+ 17,
819
+ 0,
820
+ 18,
821
+ 0,
822
+ "IMAGE"
823
+ ],
824
+ [
825
+ 32,
826
+ 12,
827
+ 0,
828
+ 16,
829
+ 0,
830
+ "MODEL"
831
+ ],
832
+ [
833
+ 33,
834
+ 19,
835
+ 0,
836
+ 16,
837
+ 3,
838
+ "LATENT"
839
+ ],
840
+ [
841
+ 34,
842
+ 19,
843
+ 0,
844
+ 3,
845
+ 3,
846
+ "LATENT"
847
+ ]
848
+ ],
849
+ "groups": [],
850
+ "config": {},
851
+ "extra": {
852
+ "ds": {
853
+ "scale": 0.5644739300537773,
854
+ "offset": {
855
+ "0": 684.6661725247097,
856
+ "1": 1204.878581445502
857
+ }
858
+ }
859
+ },
860
+ "version": 0.4
861
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_precise_weight_type.json ADDED
@@ -0,0 +1,965 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 21,
3
+ "last_link_id": 32,
4
+ "nodes": [
5
+ {
6
+ "id": 7,
7
+ "type": "CLIPTextEncode",
8
+ "pos": [
9
+ 176,
10
+ 345
11
+ ],
12
+ "size": {
13
+ "0": 425.27801513671875,
14
+ "1": 180.6060791015625
15
+ },
16
+ "flags": {},
17
+ "order": 8,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "clip",
22
+ "type": "CLIP",
23
+ "link": 5
24
+ }
25
+ ],
26
+ "outputs": [
27
+ {
28
+ "name": "CONDITIONING",
29
+ "type": "CONDITIONING",
30
+ "links": [
31
+ 6,
32
+ 22
33
+ ],
34
+ "slot_index": 0
35
+ }
36
+ ],
37
+ "properties": {
38
+ "Node name for S&R": "CLIPTextEncode"
39
+ },
40
+ "widgets_values": [
41
+ "horror"
42
+ ]
43
+ },
44
+ {
45
+ "id": 15,
46
+ "type": "KSampler",
47
+ "pos": [
48
+ 1170,
49
+ 820
50
+ ],
51
+ "size": [
52
+ 315,
53
+ 262
54
+ ],
55
+ "flags": {},
56
+ "order": 12,
57
+ "mode": 0,
58
+ "inputs": [
59
+ {
60
+ "name": "model",
61
+ "type": "MODEL",
62
+ "link": 20
63
+ },
64
+ {
65
+ "name": "positive",
66
+ "type": "CONDITIONING",
67
+ "link": 21
68
+ },
69
+ {
70
+ "name": "negative",
71
+ "type": "CONDITIONING",
72
+ "link": 22
73
+ },
74
+ {
75
+ "name": "latent_image",
76
+ "type": "LATENT",
77
+ "link": 23
78
+ },
79
+ {
80
+ "name": "seed",
81
+ "type": "INT",
82
+ "link": 32,
83
+ "widget": {
84
+ "name": "seed"
85
+ }
86
+ }
87
+ ],
88
+ "outputs": [
89
+ {
90
+ "name": "LATENT",
91
+ "type": "LATENT",
92
+ "links": [
93
+ 24
94
+ ],
95
+ "slot_index": 0
96
+ }
97
+ ],
98
+ "properties": {
99
+ "Node name for S&R": "KSampler"
100
+ },
101
+ "widgets_values": [
102
+ 46,
103
+ "fixed",
104
+ 20,
105
+ 7,
106
+ "dpmpp_2m",
107
+ "karras",
108
+ 1
109
+ ]
110
+ },
111
+ {
112
+ "id": 16,
113
+ "type": "VAEDecode",
114
+ "pos": [
115
+ 1520,
116
+ 820
117
+ ],
118
+ "size": {
119
+ "0": 210,
120
+ "1": 46
121
+ },
122
+ "flags": {},
123
+ "order": 14,
124
+ "mode": 0,
125
+ "inputs": [
126
+ {
127
+ "name": "samples",
128
+ "type": "LATENT",
129
+ "link": 24
130
+ },
131
+ {
132
+ "name": "vae",
133
+ "type": "VAE",
134
+ "link": 25
135
+ }
136
+ ],
137
+ "outputs": [
138
+ {
139
+ "name": "IMAGE",
140
+ "type": "IMAGE",
141
+ "links": [
142
+ 29
143
+ ],
144
+ "slot_index": 0
145
+ }
146
+ ],
147
+ "properties": {
148
+ "Node name for S&R": "VAEDecode"
149
+ }
150
+ },
151
+ {
152
+ "id": 11,
153
+ "type": "IPAdapterUnifiedLoader",
154
+ "pos": [
155
+ -217,
156
+ 460
157
+ ],
158
+ "size": {
159
+ "0": 210,
160
+ "1": 78
161
+ },
162
+ "flags": {},
163
+ "order": 6,
164
+ "mode": 0,
165
+ "inputs": [
166
+ {
167
+ "name": "model",
168
+ "type": "MODEL",
169
+ "link": 11
170
+ },
171
+ {
172
+ "name": "ipadapter",
173
+ "type": "IPADAPTER",
174
+ "link": null
175
+ }
176
+ ],
177
+ "outputs": [
178
+ {
179
+ "name": "model",
180
+ "type": "MODEL",
181
+ "links": [
182
+ 12,
183
+ 26
184
+ ],
185
+ "shape": 3,
186
+ "slot_index": 0
187
+ },
188
+ {
189
+ "name": "ipadapter",
190
+ "type": "IPADAPTER",
191
+ "links": [
192
+ 10,
193
+ 27
194
+ ],
195
+ "shape": 3
196
+ }
197
+ ],
198
+ "properties": {
199
+ "Node name for S&R": "IPAdapterUnifiedLoader"
200
+ },
201
+ "widgets_values": [
202
+ "PLUS (high strength)"
203
+ ]
204
+ },
205
+ {
206
+ "id": 6,
207
+ "type": "CLIPTextEncode",
208
+ "pos": [
209
+ 165,
210
+ 112
211
+ ],
212
+ "size": {
213
+ "0": 422.84503173828125,
214
+ "1": 164.31304931640625
215
+ },
216
+ "flags": {},
217
+ "order": 7,
218
+ "mode": 0,
219
+ "inputs": [
220
+ {
221
+ "name": "clip",
222
+ "type": "CLIP",
223
+ "link": 3
224
+ }
225
+ ],
226
+ "outputs": [
227
+ {
228
+ "name": "CONDITIONING",
229
+ "type": "CONDITIONING",
230
+ "links": [
231
+ 4,
232
+ 21
233
+ ],
234
+ "slot_index": 0
235
+ }
236
+ ],
237
+ "properties": {
238
+ "Node name for S&R": "CLIPTextEncode"
239
+ },
240
+ "widgets_values": [
241
+ "closeup of a woman"
242
+ ]
243
+ },
244
+ {
245
+ "id": 4,
246
+ "type": "CheckpointLoaderSimple",
247
+ "pos": [
248
+ -717,
249
+ 221
250
+ ],
251
+ "size": {
252
+ "0": 315,
253
+ "1": 98
254
+ },
255
+ "flags": {},
256
+ "order": 0,
257
+ "mode": 0,
258
+ "outputs": [
259
+ {
260
+ "name": "MODEL",
261
+ "type": "MODEL",
262
+ "links": [
263
+ 11
264
+ ],
265
+ "slot_index": 0
266
+ },
267
+ {
268
+ "name": "CLIP",
269
+ "type": "CLIP",
270
+ "links": [
271
+ 3,
272
+ 5
273
+ ],
274
+ "slot_index": 1
275
+ },
276
+ {
277
+ "name": "VAE",
278
+ "type": "VAE",
279
+ "links": [
280
+ 8,
281
+ 25
282
+ ],
283
+ "slot_index": 2
284
+ }
285
+ ],
286
+ "properties": {
287
+ "Node name for S&R": "CheckpointLoaderSimple"
288
+ },
289
+ "widgets_values": [
290
+ "sdxl/ProteusV0.3.safetensors"
291
+ ]
292
+ },
293
+ {
294
+ "id": 3,
295
+ "type": "KSampler",
296
+ "pos": [
297
+ 1120,
298
+ -160
299
+ ],
300
+ "size": [
301
+ 303.1144735315229,
302
+ 234
303
+ ],
304
+ "flags": {},
305
+ "order": 11,
306
+ "mode": 0,
307
+ "inputs": [
308
+ {
309
+ "name": "model",
310
+ "type": "MODEL",
311
+ "link": 13
312
+ },
313
+ {
314
+ "name": "positive",
315
+ "type": "CONDITIONING",
316
+ "link": 4
317
+ },
318
+ {
319
+ "name": "negative",
320
+ "type": "CONDITIONING",
321
+ "link": 6
322
+ },
323
+ {
324
+ "name": "latent_image",
325
+ "type": "LATENT",
326
+ "link": 2
327
+ },
328
+ {
329
+ "name": "seed",
330
+ "type": "INT",
331
+ "link": 31,
332
+ "widget": {
333
+ "name": "seed"
334
+ },
335
+ "slot_index": 4
336
+ }
337
+ ],
338
+ "outputs": [
339
+ {
340
+ "name": "LATENT",
341
+ "type": "LATENT",
342
+ "links": [
343
+ 7
344
+ ],
345
+ "slot_index": 0
346
+ }
347
+ ],
348
+ "properties": {
349
+ "Node name for S&R": "KSampler"
350
+ },
351
+ "widgets_values": [
352
+ 46,
353
+ "fixed",
354
+ 20,
355
+ 7,
356
+ "dpmpp_2m",
357
+ "karras",
358
+ 1
359
+ ]
360
+ },
361
+ {
362
+ "id": 8,
363
+ "type": "VAEDecode",
364
+ "pos": [
365
+ 1480,
366
+ -160
367
+ ],
368
+ "size": {
369
+ "0": 210,
370
+ "1": 46
371
+ },
372
+ "flags": {},
373
+ "order": 13,
374
+ "mode": 0,
375
+ "inputs": [
376
+ {
377
+ "name": "samples",
378
+ "type": "LATENT",
379
+ "link": 7
380
+ },
381
+ {
382
+ "name": "vae",
383
+ "type": "VAE",
384
+ "link": 8
385
+ }
386
+ ],
387
+ "outputs": [
388
+ {
389
+ "name": "IMAGE",
390
+ "type": "IMAGE",
391
+ "links": [
392
+ 19
393
+ ],
394
+ "slot_index": 0
395
+ }
396
+ ],
397
+ "properties": {
398
+ "Node name for S&R": "VAEDecode"
399
+ }
400
+ },
401
+ {
402
+ "id": 13,
403
+ "type": "PreviewImage",
404
+ "pos": [
405
+ 1420,
406
+ 180
407
+ ],
408
+ "size": {
409
+ "0": 470.4912414550781,
410
+ "1": 481.162353515625
411
+ },
412
+ "flags": {},
413
+ "order": 15,
414
+ "mode": 0,
415
+ "inputs": [
416
+ {
417
+ "name": "images",
418
+ "type": "IMAGE",
419
+ "link": 19
420
+ }
421
+ ],
422
+ "properties": {
423
+ "Node name for S&R": "PreviewImage"
424
+ }
425
+ },
426
+ {
427
+ "id": 18,
428
+ "type": "PreviewImage",
429
+ "pos": [
430
+ 1944,
431
+ 185
432
+ ],
433
+ "size": {
434
+ "0": 470.4912414550781,
435
+ "1": 481.162353515625
436
+ },
437
+ "flags": {},
438
+ "order": 16,
439
+ "mode": 0,
440
+ "inputs": [
441
+ {
442
+ "name": "images",
443
+ "type": "IMAGE",
444
+ "link": 29
445
+ }
446
+ ],
447
+ "properties": {
448
+ "Node name for S&R": "PreviewImage"
449
+ }
450
+ },
451
+ {
452
+ "id": 20,
453
+ "type": "Note",
454
+ "pos": [
455
+ 1670,
456
+ 73
457
+ ],
458
+ "size": {
459
+ "0": 210,
460
+ "1": 58
461
+ },
462
+ "flags": {},
463
+ "order": 1,
464
+ "mode": 0,
465
+ "properties": {
466
+ "text": ""
467
+ },
468
+ "widgets_values": [
469
+ "Standard"
470
+ ],
471
+ "color": "#432",
472
+ "bgcolor": "#653"
473
+ },
474
+ {
475
+ "id": 21,
476
+ "type": "Note",
477
+ "pos": [
478
+ 2199,
479
+ 78
480
+ ],
481
+ "size": {
482
+ "0": 210,
483
+ "1": 58
484
+ },
485
+ "flags": {},
486
+ "order": 2,
487
+ "mode": 0,
488
+ "properties": {
489
+ "text": ""
490
+ },
491
+ "widgets_values": [
492
+ "Precise"
493
+ ],
494
+ "color": "#432",
495
+ "bgcolor": "#653"
496
+ },
497
+ {
498
+ "id": 5,
499
+ "type": "EmptyLatentImage",
500
+ "pos": [
501
+ 276,
502
+ 612
503
+ ],
504
+ "size": {
505
+ "0": 315,
506
+ "1": 106
507
+ },
508
+ "flags": {},
509
+ "order": 3,
510
+ "mode": 0,
511
+ "outputs": [
512
+ {
513
+ "name": "LATENT",
514
+ "type": "LATENT",
515
+ "links": [
516
+ 2,
517
+ 23
518
+ ],
519
+ "slot_index": 0
520
+ }
521
+ ],
522
+ "properties": {
523
+ "Node name for S&R": "EmptyLatentImage"
524
+ },
525
+ "widgets_values": [
526
+ 1024,
527
+ 1024,
528
+ 1
529
+ ]
530
+ },
531
+ {
532
+ "id": 10,
533
+ "type": "IPAdapterAdvanced",
534
+ "pos": [
535
+ 740,
536
+ -160
537
+ ],
538
+ "size": {
539
+ "0": 315,
540
+ "1": 278
541
+ },
542
+ "flags": {},
543
+ "order": 9,
544
+ "mode": 0,
545
+ "inputs": [
546
+ {
547
+ "name": "model",
548
+ "type": "MODEL",
549
+ "link": 12
550
+ },
551
+ {
552
+ "name": "ipadapter",
553
+ "type": "IPADAPTER",
554
+ "link": 10,
555
+ "slot_index": 1
556
+ },
557
+ {
558
+ "name": "image",
559
+ "type": "IMAGE",
560
+ "link": 14,
561
+ "slot_index": 2
562
+ },
563
+ {
564
+ "name": "image_negative",
565
+ "type": "IMAGE",
566
+ "link": null
567
+ },
568
+ {
569
+ "name": "attn_mask",
570
+ "type": "MASK",
571
+ "link": null
572
+ },
573
+ {
574
+ "name": "clip_vision",
575
+ "type": "CLIP_VISION",
576
+ "link": null
577
+ }
578
+ ],
579
+ "outputs": [
580
+ {
581
+ "name": "MODEL",
582
+ "type": "MODEL",
583
+ "links": [
584
+ 13
585
+ ],
586
+ "shape": 3,
587
+ "slot_index": 0
588
+ }
589
+ ],
590
+ "properties": {
591
+ "Node name for S&R": "IPAdapterAdvanced"
592
+ },
593
+ "widgets_values": [
594
+ 1,
595
+ "style transfer",
596
+ "concat",
597
+ 0,
598
+ 1,
599
+ "V only"
600
+ ]
601
+ },
602
+ {
603
+ "id": 17,
604
+ "type": "IPAdapterAdvanced",
605
+ "pos": [
606
+ 760,
607
+ 820
608
+ ],
609
+ "size": {
610
+ "0": 315,
611
+ "1": 278
612
+ },
613
+ "flags": {},
614
+ "order": 10,
615
+ "mode": 0,
616
+ "inputs": [
617
+ {
618
+ "name": "model",
619
+ "type": "MODEL",
620
+ "link": 26
621
+ },
622
+ {
623
+ "name": "ipadapter",
624
+ "type": "IPADAPTER",
625
+ "link": 27,
626
+ "slot_index": 1
627
+ },
628
+ {
629
+ "name": "image",
630
+ "type": "IMAGE",
631
+ "link": 28,
632
+ "slot_index": 2
633
+ },
634
+ {
635
+ "name": "image_negative",
636
+ "type": "IMAGE",
637
+ "link": null
638
+ },
639
+ {
640
+ "name": "attn_mask",
641
+ "type": "MASK",
642
+ "link": null
643
+ },
644
+ {
645
+ "name": "clip_vision",
646
+ "type": "CLIP_VISION",
647
+ "link": null
648
+ }
649
+ ],
650
+ "outputs": [
651
+ {
652
+ "name": "MODEL",
653
+ "type": "MODEL",
654
+ "links": [
655
+ 20
656
+ ],
657
+ "shape": 3,
658
+ "slot_index": 0
659
+ }
660
+ ],
661
+ "properties": {
662
+ "Node name for S&R": "IPAdapterAdvanced"
663
+ },
664
+ "widgets_values": [
665
+ 1,
666
+ "style transfer precise",
667
+ "concat",
668
+ 0,
669
+ 1,
670
+ "V only"
671
+ ]
672
+ },
673
+ {
674
+ "id": 12,
675
+ "type": "LoadImage",
676
+ "pos": [
677
+ -173,
678
+ -259
679
+ ],
680
+ "size": [
681
+ 210,
682
+ 314
683
+ ],
684
+ "flags": {},
685
+ "order": 4,
686
+ "mode": 0,
687
+ "outputs": [
688
+ {
689
+ "name": "IMAGE",
690
+ "type": "IMAGE",
691
+ "links": [
692
+ 14,
693
+ 28
694
+ ],
695
+ "shape": 3,
696
+ "slot_index": 0
697
+ },
698
+ {
699
+ "name": "MASK",
700
+ "type": "MASK",
701
+ "links": null,
702
+ "shape": 3
703
+ }
704
+ ],
705
+ "properties": {
706
+ "Node name for S&R": "LoadImage"
707
+ },
708
+ "widgets_values": [
709
+ "coloring_landscape.png",
710
+ "image"
711
+ ]
712
+ },
713
+ {
714
+ "id": 19,
715
+ "type": "PrimitiveNode",
716
+ "pos": [
717
+ 849,
718
+ 385
719
+ ],
720
+ "size": {
721
+ "0": 210,
722
+ "1": 82
723
+ },
724
+ "flags": {},
725
+ "order": 5,
726
+ "mode": 0,
727
+ "outputs": [
728
+ {
729
+ "name": "INT",
730
+ "type": "INT",
731
+ "links": [
732
+ 31,
733
+ 32
734
+ ],
735
+ "widget": {
736
+ "name": "seed"
737
+ },
738
+ "slot_index": 0
739
+ }
740
+ ],
741
+ "title": "seed",
742
+ "properties": {
743
+ "Run widget replace on values": false
744
+ },
745
+ "widgets_values": [
746
+ 46,
747
+ "fixed"
748
+ ]
749
+ }
750
+ ],
751
+ "links": [
752
+ [
753
+ 2,
754
+ 5,
755
+ 0,
756
+ 3,
757
+ 3,
758
+ "LATENT"
759
+ ],
760
+ [
761
+ 3,
762
+ 4,
763
+ 1,
764
+ 6,
765
+ 0,
766
+ "CLIP"
767
+ ],
768
+ [
769
+ 4,
770
+ 6,
771
+ 0,
772
+ 3,
773
+ 1,
774
+ "CONDITIONING"
775
+ ],
776
+ [
777
+ 5,
778
+ 4,
779
+ 1,
780
+ 7,
781
+ 0,
782
+ "CLIP"
783
+ ],
784
+ [
785
+ 6,
786
+ 7,
787
+ 0,
788
+ 3,
789
+ 2,
790
+ "CONDITIONING"
791
+ ],
792
+ [
793
+ 7,
794
+ 3,
795
+ 0,
796
+ 8,
797
+ 0,
798
+ "LATENT"
799
+ ],
800
+ [
801
+ 8,
802
+ 4,
803
+ 2,
804
+ 8,
805
+ 1,
806
+ "VAE"
807
+ ],
808
+ [
809
+ 10,
810
+ 11,
811
+ 1,
812
+ 10,
813
+ 1,
814
+ "IPADAPTER"
815
+ ],
816
+ [
817
+ 11,
818
+ 4,
819
+ 0,
820
+ 11,
821
+ 0,
822
+ "MODEL"
823
+ ],
824
+ [
825
+ 12,
826
+ 11,
827
+ 0,
828
+ 10,
829
+ 0,
830
+ "MODEL"
831
+ ],
832
+ [
833
+ 13,
834
+ 10,
835
+ 0,
836
+ 3,
837
+ 0,
838
+ "MODEL"
839
+ ],
840
+ [
841
+ 14,
842
+ 12,
843
+ 0,
844
+ 10,
845
+ 2,
846
+ "IMAGE"
847
+ ],
848
+ [
849
+ 19,
850
+ 8,
851
+ 0,
852
+ 13,
853
+ 0,
854
+ "IMAGE"
855
+ ],
856
+ [
857
+ 20,
858
+ 17,
859
+ 0,
860
+ 15,
861
+ 0,
862
+ "MODEL"
863
+ ],
864
+ [
865
+ 21,
866
+ 6,
867
+ 0,
868
+ 15,
869
+ 1,
870
+ "CONDITIONING"
871
+ ],
872
+ [
873
+ 22,
874
+ 7,
875
+ 0,
876
+ 15,
877
+ 2,
878
+ "CONDITIONING"
879
+ ],
880
+ [
881
+ 23,
882
+ 5,
883
+ 0,
884
+ 15,
885
+ 3,
886
+ "LATENT"
887
+ ],
888
+ [
889
+ 24,
890
+ 15,
891
+ 0,
892
+ 16,
893
+ 0,
894
+ "LATENT"
895
+ ],
896
+ [
897
+ 25,
898
+ 4,
899
+ 2,
900
+ 16,
901
+ 1,
902
+ "VAE"
903
+ ],
904
+ [
905
+ 26,
906
+ 11,
907
+ 0,
908
+ 17,
909
+ 0,
910
+ "MODEL"
911
+ ],
912
+ [
913
+ 27,
914
+ 11,
915
+ 1,
916
+ 17,
917
+ 1,
918
+ "IPADAPTER"
919
+ ],
920
+ [
921
+ 28,
922
+ 12,
923
+ 0,
924
+ 17,
925
+ 2,
926
+ "IMAGE"
927
+ ],
928
+ [
929
+ 29,
930
+ 16,
931
+ 0,
932
+ 18,
933
+ 0,
934
+ "IMAGE"
935
+ ],
936
+ [
937
+ 31,
938
+ 19,
939
+ 0,
940
+ 3,
941
+ 4,
942
+ "INT"
943
+ ],
944
+ [
945
+ 32,
946
+ 19,
947
+ 0,
948
+ 15,
949
+ 4,
950
+ "INT"
951
+ ]
952
+ ],
953
+ "groups": [],
954
+ "config": {},
955
+ "extra": {
956
+ "ds": {
957
+ "scale": 0.26333125430607984,
958
+ "offset": [
959
+ 1597.1013613507125,
960
+ 1587.4809464007888
961
+ ]
962
+ }
963
+ },
964
+ "version": 0.4
965
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_regional_conditioning.json ADDED
@@ -0,0 +1,1512 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 96,
3
+ "last_link_id": 196,
4
+ "nodes": [
5
+ {
6
+ "id": 18,
7
+ "type": "PreviewImage",
8
+ "pos": [
9
+ 2770,
10
+ 1030
11
+ ],
12
+ "size": {
13
+ "0": 874.8703002929688,
14
+ "1": 614.3541259765625
15
+ },
16
+ "flags": {},
17
+ "order": 23,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "images",
22
+ "type": "IMAGE",
23
+ "link": 12
24
+ }
25
+ ],
26
+ "properties": {
27
+ "Node name for S&R": "PreviewImage"
28
+ }
29
+ },
30
+ {
31
+ "id": 8,
32
+ "type": "VAEDecode",
33
+ "pos": [
34
+ 2750,
35
+ 890
36
+ ],
37
+ "size": {
38
+ "0": 210,
39
+ "1": 46
40
+ },
41
+ "flags": {},
42
+ "order": 22,
43
+ "mode": 0,
44
+ "inputs": [
45
+ {
46
+ "name": "samples",
47
+ "type": "LATENT",
48
+ "link": 7
49
+ },
50
+ {
51
+ "name": "vae",
52
+ "type": "VAE",
53
+ "link": 8
54
+ }
55
+ ],
56
+ "outputs": [
57
+ {
58
+ "name": "IMAGE",
59
+ "type": "IMAGE",
60
+ "links": [
61
+ 12
62
+ ],
63
+ "slot_index": 0
64
+ }
65
+ ],
66
+ "properties": {
67
+ "Node name for S&R": "VAEDecode"
68
+ }
69
+ },
70
+ {
71
+ "id": 72,
72
+ "type": "LoadImage",
73
+ "pos": [
74
+ -110,
75
+ 510
76
+ ],
77
+ "size": {
78
+ "0": 315,
79
+ "1": 314
80
+ },
81
+ "flags": {},
82
+ "order": 0,
83
+ "mode": 0,
84
+ "outputs": [
85
+ {
86
+ "name": "IMAGE",
87
+ "type": "IMAGE",
88
+ "links": [
89
+ 150
90
+ ],
91
+ "shape": 3,
92
+ "slot_index": 0
93
+ },
94
+ {
95
+ "name": "MASK",
96
+ "type": "MASK",
97
+ "links": null,
98
+ "shape": 3
99
+ }
100
+ ],
101
+ "properties": {
102
+ "Node name for S&R": "LoadImage"
103
+ },
104
+ "widgets_values": [
105
+ "mask_red_green (1).png",
106
+ "image"
107
+ ]
108
+ },
109
+ {
110
+ "id": 73,
111
+ "type": "MaskFromRGBCMYBW+",
112
+ "pos": [
113
+ 250,
114
+ 510
115
+ ],
116
+ "size": {
117
+ "0": 315,
118
+ "1": 294
119
+ },
120
+ "flags": {},
121
+ "order": 6,
122
+ "mode": 0,
123
+ "inputs": [
124
+ {
125
+ "name": "image",
126
+ "type": "IMAGE",
127
+ "link": 150
128
+ }
129
+ ],
130
+ "outputs": [
131
+ {
132
+ "name": "red",
133
+ "type": "MASK",
134
+ "links": [
135
+ 159
136
+ ],
137
+ "shape": 3,
138
+ "slot_index": 0
139
+ },
140
+ {
141
+ "name": "green",
142
+ "type": "MASK",
143
+ "links": [
144
+ 157
145
+ ],
146
+ "shape": 3,
147
+ "slot_index": 1
148
+ },
149
+ {
150
+ "name": "blue",
151
+ "type": "MASK",
152
+ "links": null,
153
+ "shape": 3
154
+ },
155
+ {
156
+ "name": "cyan",
157
+ "type": "MASK",
158
+ "links": null,
159
+ "shape": 3
160
+ },
161
+ {
162
+ "name": "magenta",
163
+ "type": "MASK",
164
+ "links": null,
165
+ "shape": 3
166
+ },
167
+ {
168
+ "name": "yellow",
169
+ "type": "MASK",
170
+ "links": null,
171
+ "shape": 3
172
+ },
173
+ {
174
+ "name": "black",
175
+ "type": "MASK",
176
+ "links": [
177
+ 161
178
+ ],
179
+ "shape": 3,
180
+ "slot_index": 6
181
+ },
182
+ {
183
+ "name": "white",
184
+ "type": "MASK",
185
+ "links": null,
186
+ "shape": 3
187
+ }
188
+ ],
189
+ "properties": {
190
+ "Node name for S&R": "MaskFromRGBCMYBW+"
191
+ },
192
+ "widgets_values": [
193
+ 0.15,
194
+ 0.15,
195
+ 0.15,
196
+ 0,
197
+ false
198
+ ]
199
+ },
200
+ {
201
+ "id": 85,
202
+ "type": "CLIPTextEncode",
203
+ "pos": [
204
+ 660,
205
+ 460
206
+ ],
207
+ "size": {
208
+ "0": 228.78353881835938,
209
+ "1": 131.52040100097656
210
+ },
211
+ "flags": {},
212
+ "order": 12,
213
+ "mode": 0,
214
+ "inputs": [
215
+ {
216
+ "name": "clip",
217
+ "type": "CLIP",
218
+ "link": 166
219
+ }
220
+ ],
221
+ "outputs": [
222
+ {
223
+ "name": "CONDITIONING",
224
+ "type": "CONDITIONING",
225
+ "links": [
226
+ 168
227
+ ],
228
+ "slot_index": 0
229
+ }
230
+ ],
231
+ "properties": {
232
+ "Node name for S&R": "CLIPTextEncode"
233
+ },
234
+ "widgets_values": [
235
+ "anime illustration of a young woman with a black jacket"
236
+ ],
237
+ "color": "#232",
238
+ "bgcolor": "#353"
239
+ },
240
+ {
241
+ "id": 87,
242
+ "type": "IPAdapterCombineParams",
243
+ "pos": [
244
+ 1547,
245
+ 291
246
+ ],
247
+ "size": {
248
+ "0": 231.11573791503906,
249
+ "1": 106
250
+ },
251
+ "flags": {},
252
+ "order": 17,
253
+ "mode": 0,
254
+ "inputs": [
255
+ {
256
+ "name": "params_1",
257
+ "type": "IPADAPTER_PARAMS",
258
+ "link": 170
259
+ },
260
+ {
261
+ "name": "params_2",
262
+ "type": "IPADAPTER_PARAMS",
263
+ "link": 171
264
+ },
265
+ {
266
+ "name": "params_3",
267
+ "type": "IPADAPTER_PARAMS",
268
+ "link": 172
269
+ },
270
+ {
271
+ "name": "params_4",
272
+ "type": "IPADAPTER_PARAMS",
273
+ "link": null
274
+ },
275
+ {
276
+ "name": "params_5",
277
+ "type": "IPADAPTER_PARAMS",
278
+ "link": null
279
+ }
280
+ ],
281
+ "outputs": [
282
+ {
283
+ "name": "IPADAPTER_PARAMS",
284
+ "type": "IPADAPTER_PARAMS",
285
+ "links": [
286
+ 181
287
+ ],
288
+ "shape": 3,
289
+ "slot_index": 0
290
+ }
291
+ ],
292
+ "properties": {
293
+ "Node name for S&R": "IPAdapterCombineParams"
294
+ }
295
+ },
296
+ {
297
+ "id": 91,
298
+ "type": "IPAdapterFromParams",
299
+ "pos": [
300
+ 1968,
301
+ 258
302
+ ],
303
+ "size": {
304
+ "0": 315,
305
+ "1": 162
306
+ },
307
+ "flags": {},
308
+ "order": 20,
309
+ "mode": 0,
310
+ "inputs": [
311
+ {
312
+ "name": "model",
313
+ "type": "MODEL",
314
+ "link": 184
315
+ },
316
+ {
317
+ "name": "ipadapter",
318
+ "type": "IPADAPTER",
319
+ "link": 182,
320
+ "slot_index": 1
321
+ },
322
+ {
323
+ "name": "ipadapter_params",
324
+ "type": "IPADAPTER_PARAMS",
325
+ "link": 181
326
+ },
327
+ {
328
+ "name": "image_negative",
329
+ "type": "IMAGE",
330
+ "link": null
331
+ },
332
+ {
333
+ "name": "clip_vision",
334
+ "type": "CLIP_VISION",
335
+ "link": null
336
+ }
337
+ ],
338
+ "outputs": [
339
+ {
340
+ "name": "MODEL",
341
+ "type": "MODEL",
342
+ "links": [
343
+ 185
344
+ ],
345
+ "shape": 3,
346
+ "slot_index": 0
347
+ }
348
+ ],
349
+ "properties": {
350
+ "Node name for S&R": "IPAdapterFromParams"
351
+ },
352
+ "widgets_values": [
353
+ "concat",
354
+ "V only"
355
+ ]
356
+ },
357
+ {
358
+ "id": 88,
359
+ "type": "ConditioningCombineMultiple+",
360
+ "pos": [
361
+ 1517,
362
+ 556
363
+ ],
364
+ "size": {
365
+ "0": 285.6000061035156,
366
+ "1": 106
367
+ },
368
+ "flags": {},
369
+ "order": 18,
370
+ "mode": 0,
371
+ "inputs": [
372
+ {
373
+ "name": "conditioning_1",
374
+ "type": "CONDITIONING",
375
+ "link": 174
376
+ },
377
+ {
378
+ "name": "conditioning_2",
379
+ "type": "CONDITIONING",
380
+ "link": 175
381
+ },
382
+ {
383
+ "name": "conditioning_3",
384
+ "type": "CONDITIONING",
385
+ "link": 176
386
+ },
387
+ {
388
+ "name": "conditioning_4",
389
+ "type": "CONDITIONING",
390
+ "link": null
391
+ },
392
+ {
393
+ "name": "conditioning_5",
394
+ "type": "CONDITIONING",
395
+ "link": null
396
+ }
397
+ ],
398
+ "outputs": [
399
+ {
400
+ "name": "CONDITIONING",
401
+ "type": "CONDITIONING",
402
+ "links": [
403
+ 186
404
+ ],
405
+ "shape": 3,
406
+ "slot_index": 0
407
+ }
408
+ ],
409
+ "properties": {
410
+ "Node name for S&R": "ConditioningCombineMultiple+"
411
+ },
412
+ "color": "#232",
413
+ "bgcolor": "#353"
414
+ },
415
+ {
416
+ "id": 89,
417
+ "type": "ConditioningCombineMultiple+",
418
+ "pos": [
419
+ 1508,
420
+ 806
421
+ ],
422
+ "size": {
423
+ "0": 285.6000061035156,
424
+ "1": 106
425
+ },
426
+ "flags": {},
427
+ "order": 19,
428
+ "mode": 0,
429
+ "inputs": [
430
+ {
431
+ "name": "conditioning_1",
432
+ "type": "CONDITIONING",
433
+ "link": 177
434
+ },
435
+ {
436
+ "name": "conditioning_2",
437
+ "type": "CONDITIONING",
438
+ "link": 178
439
+ },
440
+ {
441
+ "name": "conditioning_3",
442
+ "type": "CONDITIONING",
443
+ "link": 179
444
+ },
445
+ {
446
+ "name": "conditioning_4",
447
+ "type": "CONDITIONING",
448
+ "link": null
449
+ },
450
+ {
451
+ "name": "conditioning_5",
452
+ "type": "CONDITIONING",
453
+ "link": null
454
+ }
455
+ ],
456
+ "outputs": [
457
+ {
458
+ "name": "CONDITIONING",
459
+ "type": "CONDITIONING",
460
+ "links": [
461
+ 187
462
+ ],
463
+ "shape": 3,
464
+ "slot_index": 0
465
+ }
466
+ ],
467
+ "properties": {
468
+ "Node name for S&R": "ConditioningCombineMultiple+"
469
+ },
470
+ "color": "#322",
471
+ "bgcolor": "#533"
472
+ },
473
+ {
474
+ "id": 80,
475
+ "type": "IPAdapterRegionalConditioning",
476
+ "pos": [
477
+ 980,
478
+ 470
479
+ ],
480
+ "size": {
481
+ "0": 317.4000244140625,
482
+ "1": 214
483
+ },
484
+ "flags": {},
485
+ "order": 16,
486
+ "mode": 0,
487
+ "inputs": [
488
+ {
489
+ "name": "image",
490
+ "type": "IMAGE",
491
+ "link": 158
492
+ },
493
+ {
494
+ "name": "mask",
495
+ "type": "MASK",
496
+ "link": 159
497
+ },
498
+ {
499
+ "name": "positive",
500
+ "type": "CONDITIONING",
501
+ "link": 168
502
+ },
503
+ {
504
+ "name": "negative",
505
+ "type": "CONDITIONING",
506
+ "link": 169
507
+ }
508
+ ],
509
+ "outputs": [
510
+ {
511
+ "name": "IPADAPTER_PARAMS",
512
+ "type": "IPADAPTER_PARAMS",
513
+ "links": [
514
+ 171
515
+ ],
516
+ "shape": 3,
517
+ "slot_index": 0
518
+ },
519
+ {
520
+ "name": "POSITIVE",
521
+ "type": "CONDITIONING",
522
+ "links": [
523
+ 175
524
+ ],
525
+ "shape": 3,
526
+ "slot_index": 1
527
+ },
528
+ {
529
+ "name": "NEGATIVE",
530
+ "type": "CONDITIONING",
531
+ "links": [
532
+ 178
533
+ ],
534
+ "shape": 3,
535
+ "slot_index": 2
536
+ }
537
+ ],
538
+ "properties": {
539
+ "Node name for S&R": "IPAdapterRegionalConditioning"
540
+ },
541
+ "widgets_values": [
542
+ 0.7000000000000001,
543
+ 1,
544
+ "linear",
545
+ 0,
546
+ 1
547
+ ]
548
+ },
549
+ {
550
+ "id": 81,
551
+ "type": "IPAdapterRegionalConditioning",
552
+ "pos": [
553
+ 980,
554
+ 850
555
+ ],
556
+ "size": {
557
+ "0": 317.4000244140625,
558
+ "1": 214
559
+ },
560
+ "flags": {},
561
+ "order": 14,
562
+ "mode": 0,
563
+ "inputs": [
564
+ {
565
+ "name": "image",
566
+ "type": "IMAGE",
567
+ "link": 160
568
+ },
569
+ {
570
+ "name": "mask",
571
+ "type": "MASK",
572
+ "link": 161
573
+ },
574
+ {
575
+ "name": "positive",
576
+ "type": "CONDITIONING",
577
+ "link": null
578
+ },
579
+ {
580
+ "name": "negative",
581
+ "type": "CONDITIONING",
582
+ "link": null
583
+ }
584
+ ],
585
+ "outputs": [
586
+ {
587
+ "name": "IPADAPTER_PARAMS",
588
+ "type": "IPADAPTER_PARAMS",
589
+ "links": [
590
+ 172
591
+ ],
592
+ "shape": 3,
593
+ "slot_index": 0
594
+ },
595
+ {
596
+ "name": "POSITIVE",
597
+ "type": "CONDITIONING",
598
+ "links": null,
599
+ "shape": 3
600
+ },
601
+ {
602
+ "name": "NEGATIVE",
603
+ "type": "CONDITIONING",
604
+ "links": null,
605
+ "shape": 3
606
+ }
607
+ ],
608
+ "properties": {
609
+ "Node name for S&R": "IPAdapterRegionalConditioning"
610
+ },
611
+ "widgets_values": [
612
+ 0.7000000000000001,
613
+ 1,
614
+ "linear",
615
+ 0,
616
+ 1
617
+ ]
618
+ },
619
+ {
620
+ "id": 84,
621
+ "type": "CLIPTextEncode",
622
+ "pos": [
623
+ 652,
624
+ 220
625
+ ],
626
+ "size": {
627
+ "0": 228.78353881835938,
628
+ "1": 131.52040100097656
629
+ },
630
+ "flags": {},
631
+ "order": 11,
632
+ "mode": 0,
633
+ "inputs": [
634
+ {
635
+ "name": "clip",
636
+ "type": "CLIP",
637
+ "link": 164
638
+ }
639
+ ],
640
+ "outputs": [
641
+ {
642
+ "name": "CONDITIONING",
643
+ "type": "CONDITIONING",
644
+ "links": [
645
+ 165
646
+ ],
647
+ "slot_index": 0
648
+ }
649
+ ],
650
+ "properties": {
651
+ "Node name for S&R": "CLIPTextEncode"
652
+ },
653
+ "widgets_values": [
654
+ "anime"
655
+ ],
656
+ "color": "#322",
657
+ "bgcolor": "#533"
658
+ },
659
+ {
660
+ "id": 79,
661
+ "type": "IPAdapterRegionalConditioning",
662
+ "pos": [
663
+ 980,
664
+ 110
665
+ ],
666
+ "size": {
667
+ "0": 317.4000244140625,
668
+ "1": 214
669
+ },
670
+ "flags": {},
671
+ "order": 15,
672
+ "mode": 0,
673
+ "inputs": [
674
+ {
675
+ "name": "image",
676
+ "type": "IMAGE",
677
+ "link": 156
678
+ },
679
+ {
680
+ "name": "mask",
681
+ "type": "MASK",
682
+ "link": 157
683
+ },
684
+ {
685
+ "name": "positive",
686
+ "type": "CONDITIONING",
687
+ "link": 163
688
+ },
689
+ {
690
+ "name": "negative",
691
+ "type": "CONDITIONING",
692
+ "link": 165
693
+ }
694
+ ],
695
+ "outputs": [
696
+ {
697
+ "name": "IPADAPTER_PARAMS",
698
+ "type": "IPADAPTER_PARAMS",
699
+ "links": [
700
+ 170
701
+ ],
702
+ "shape": 3,
703
+ "slot_index": 0
704
+ },
705
+ {
706
+ "name": "POSITIVE",
707
+ "type": "CONDITIONING",
708
+ "links": [
709
+ 174
710
+ ],
711
+ "shape": 3,
712
+ "slot_index": 1
713
+ },
714
+ {
715
+ "name": "NEGATIVE",
716
+ "type": "CONDITIONING",
717
+ "links": [
718
+ 177
719
+ ],
720
+ "shape": 3,
721
+ "slot_index": 2
722
+ }
723
+ ],
724
+ "properties": {
725
+ "Node name for S&R": "IPAdapterRegionalConditioning"
726
+ },
727
+ "widgets_values": [
728
+ 0.7000000000000001,
729
+ 1,
730
+ "linear",
731
+ 0,
732
+ 1
733
+ ]
734
+ },
735
+ {
736
+ "id": 41,
737
+ "type": "CLIPTextEncode",
738
+ "pos": [
739
+ 416,
740
+ 1189
741
+ ],
742
+ "size": {
743
+ "0": 422.84503173828125,
744
+ "1": 164.31304931640625
745
+ },
746
+ "flags": {},
747
+ "order": 9,
748
+ "mode": 0,
749
+ "inputs": [
750
+ {
751
+ "name": "clip",
752
+ "type": "CLIP",
753
+ "link": 57
754
+ }
755
+ ],
756
+ "outputs": [
757
+ {
758
+ "name": "CONDITIONING",
759
+ "type": "CONDITIONING",
760
+ "links": [
761
+ 176
762
+ ],
763
+ "slot_index": 0
764
+ }
765
+ ],
766
+ "properties": {
767
+ "Node name for S&R": "CLIPTextEncode"
768
+ },
769
+ "widgets_values": [
770
+ "closeup of two girl friends shopping in a sci-fi space station\n\nhigh quality, detailed"
771
+ ],
772
+ "color": "#232",
773
+ "bgcolor": "#353"
774
+ },
775
+ {
776
+ "id": 7,
777
+ "type": "CLIPTextEncode",
778
+ "pos": [
779
+ 415,
780
+ 1429
781
+ ],
782
+ "size": {
783
+ "0": 425.27801513671875,
784
+ "1": 180.6060791015625
785
+ },
786
+ "flags": {},
787
+ "order": 8,
788
+ "mode": 0,
789
+ "inputs": [
790
+ {
791
+ "name": "clip",
792
+ "type": "CLIP",
793
+ "link": 5
794
+ }
795
+ ],
796
+ "outputs": [
797
+ {
798
+ "name": "CONDITIONING",
799
+ "type": "CONDITIONING",
800
+ "links": [
801
+ 179
802
+ ],
803
+ "slot_index": 0
804
+ }
805
+ ],
806
+ "properties": {
807
+ "Node name for S&R": "CLIPTextEncode"
808
+ },
809
+ "widgets_values": [
810
+ "blurry, lowres, photo, distorted, ill, malformed, glitch, dirt, weird, text, naked"
811
+ ],
812
+ "color": "#322",
813
+ "bgcolor": "#533"
814
+ },
815
+ {
816
+ "id": 3,
817
+ "type": "KSampler",
818
+ "pos": [
819
+ 2370,
820
+ 880
821
+ ],
822
+ "size": {
823
+ "0": 315,
824
+ "1": 262
825
+ },
826
+ "flags": {},
827
+ "order": 21,
828
+ "mode": 0,
829
+ "inputs": [
830
+ {
831
+ "name": "model",
832
+ "type": "MODEL",
833
+ "link": 185
834
+ },
835
+ {
836
+ "name": "positive",
837
+ "type": "CONDITIONING",
838
+ "link": 186
839
+ },
840
+ {
841
+ "name": "negative",
842
+ "type": "CONDITIONING",
843
+ "link": 187
844
+ },
845
+ {
846
+ "name": "latent_image",
847
+ "type": "LATENT",
848
+ "link": 149,
849
+ "slot_index": 3
850
+ }
851
+ ],
852
+ "outputs": [
853
+ {
854
+ "name": "LATENT",
855
+ "type": "LATENT",
856
+ "links": [
857
+ 7
858
+ ],
859
+ "slot_index": 0
860
+ }
861
+ ],
862
+ "properties": {
863
+ "Node name for S&R": "KSampler"
864
+ },
865
+ "widgets_values": [
866
+ 5,
867
+ "fixed",
868
+ 40,
869
+ 8,
870
+ "dpmpp_2m",
871
+ "karras",
872
+ 1
873
+ ]
874
+ },
875
+ {
876
+ "id": 4,
877
+ "type": "CheckpointLoaderSimple",
878
+ "pos": [
879
+ -113,
880
+ 968
881
+ ],
882
+ "size": {
883
+ "0": 315,
884
+ "1": 98
885
+ },
886
+ "flags": {},
887
+ "order": 1,
888
+ "mode": 0,
889
+ "outputs": [
890
+ {
891
+ "name": "MODEL",
892
+ "type": "MODEL",
893
+ "links": [
894
+ 183
895
+ ],
896
+ "slot_index": 0
897
+ },
898
+ {
899
+ "name": "CLIP",
900
+ "type": "CLIP",
901
+ "links": [
902
+ 5,
903
+ 57,
904
+ 162,
905
+ 164,
906
+ 166,
907
+ 167
908
+ ],
909
+ "slot_index": 1
910
+ },
911
+ {
912
+ "name": "VAE",
913
+ "type": "VAE",
914
+ "links": [
915
+ 8
916
+ ],
917
+ "slot_index": 2
918
+ }
919
+ ],
920
+ "properties": {
921
+ "Node name for S&R": "CheckpointLoaderSimple"
922
+ },
923
+ "widgets_values": [
924
+ "sd15/juggernaut_reborn.safetensors"
925
+ ]
926
+ },
927
+ {
928
+ "id": 69,
929
+ "type": "LoadImage",
930
+ "pos": [
931
+ -565,
932
+ 90
933
+ ],
934
+ "size": {
935
+ "0": 315,
936
+ "1": 314
937
+ },
938
+ "flags": {},
939
+ "order": 2,
940
+ "mode": 0,
941
+ "outputs": [
942
+ {
943
+ "name": "IMAGE",
944
+ "type": "IMAGE",
945
+ "links": [
946
+ 156
947
+ ],
948
+ "shape": 3,
949
+ "slot_index": 0
950
+ },
951
+ {
952
+ "name": "MASK",
953
+ "type": "MASK",
954
+ "links": null,
955
+ "shape": 3
956
+ }
957
+ ],
958
+ "properties": {
959
+ "Node name for S&R": "LoadImage"
960
+ },
961
+ "widgets_values": [
962
+ "frazetta.jpg",
963
+ "image"
964
+ ]
965
+ },
966
+ {
967
+ "id": 70,
968
+ "type": "LoadImage",
969
+ "pos": [
970
+ -571,
971
+ 463
972
+ ],
973
+ "size": {
974
+ "0": 315,
975
+ "1": 314
976
+ },
977
+ "flags": {},
978
+ "order": 3,
979
+ "mode": 0,
980
+ "outputs": [
981
+ {
982
+ "name": "IMAGE",
983
+ "type": "IMAGE",
984
+ "links": [
985
+ 158
986
+ ],
987
+ "shape": 3,
988
+ "slot_index": 0
989
+ },
990
+ {
991
+ "name": "MASK",
992
+ "type": "MASK",
993
+ "links": null,
994
+ "shape": 3
995
+ }
996
+ ],
997
+ "properties": {
998
+ "Node name for S&R": "LoadImage"
999
+ },
1000
+ "widgets_values": [
1001
+ "anime_illustration.png",
1002
+ "image"
1003
+ ]
1004
+ },
1005
+ {
1006
+ "id": 71,
1007
+ "type": "LoadImage",
1008
+ "pos": [
1009
+ -575,
1010
+ 843
1011
+ ],
1012
+ "size": {
1013
+ "0": 315,
1014
+ "1": 314
1015
+ },
1016
+ "flags": {},
1017
+ "order": 4,
1018
+ "mode": 0,
1019
+ "outputs": [
1020
+ {
1021
+ "name": "IMAGE",
1022
+ "type": "IMAGE",
1023
+ "links": [
1024
+ 160
1025
+ ],
1026
+ "shape": 3,
1027
+ "slot_index": 0
1028
+ },
1029
+ {
1030
+ "name": "MASK",
1031
+ "type": "MASK",
1032
+ "links": null,
1033
+ "shape": 3
1034
+ }
1035
+ ],
1036
+ "properties": {
1037
+ "Node name for S&R": "LoadImage"
1038
+ },
1039
+ "widgets_values": [
1040
+ "alien5.jpeg",
1041
+ "image"
1042
+ ]
1043
+ },
1044
+ {
1045
+ "id": 83,
1046
+ "type": "CLIPTextEncode",
1047
+ "pos": [
1048
+ 649,
1049
+ 35
1050
+ ],
1051
+ "size": {
1052
+ "0": 228.78353881835938,
1053
+ "1": 131.52040100097656
1054
+ },
1055
+ "flags": {},
1056
+ "order": 10,
1057
+ "mode": 0,
1058
+ "inputs": [
1059
+ {
1060
+ "name": "clip",
1061
+ "type": "CLIP",
1062
+ "link": 162
1063
+ }
1064
+ ],
1065
+ "outputs": [
1066
+ {
1067
+ "name": "CONDITIONING",
1068
+ "type": "CONDITIONING",
1069
+ "links": [
1070
+ 163
1071
+ ],
1072
+ "slot_index": 0
1073
+ }
1074
+ ],
1075
+ "properties": {
1076
+ "Node name for S&R": "CLIPTextEncode"
1077
+ },
1078
+ "widgets_values": [
1079
+ "illustration of a blonde woman with beautiful eyes"
1080
+ ],
1081
+ "color": "#232",
1082
+ "bgcolor": "#353"
1083
+ },
1084
+ {
1085
+ "id": 86,
1086
+ "type": "CLIPTextEncode",
1087
+ "pos": [
1088
+ 653,
1089
+ 640
1090
+ ],
1091
+ "size": {
1092
+ "0": 228.78353881835938,
1093
+ "1": 131.52040100097656
1094
+ },
1095
+ "flags": {},
1096
+ "order": 13,
1097
+ "mode": 0,
1098
+ "inputs": [
1099
+ {
1100
+ "name": "clip",
1101
+ "type": "CLIP",
1102
+ "link": 167
1103
+ }
1104
+ ],
1105
+ "outputs": [
1106
+ {
1107
+ "name": "CONDITIONING",
1108
+ "type": "CONDITIONING",
1109
+ "links": [
1110
+ 169
1111
+ ],
1112
+ "slot_index": 0
1113
+ }
1114
+ ],
1115
+ "properties": {
1116
+ "Node name for S&R": "CLIPTextEncode"
1117
+ },
1118
+ "widgets_values": [
1119
+ "(dirt, scar, tattoo:1.1)"
1120
+ ],
1121
+ "color": "#322",
1122
+ "bgcolor": "#533"
1123
+ },
1124
+ {
1125
+ "id": 68,
1126
+ "type": "EmptyLatentImage",
1127
+ "pos": [
1128
+ 1978,
1129
+ 1033
1130
+ ],
1131
+ "size": {
1132
+ "0": 315,
1133
+ "1": 106
1134
+ },
1135
+ "flags": {},
1136
+ "order": 5,
1137
+ "mode": 0,
1138
+ "outputs": [
1139
+ {
1140
+ "name": "LATENT",
1141
+ "type": "LATENT",
1142
+ "links": [
1143
+ 149
1144
+ ],
1145
+ "shape": 3
1146
+ }
1147
+ ],
1148
+ "properties": {
1149
+ "Node name for S&R": "EmptyLatentImage"
1150
+ },
1151
+ "widgets_values": [
1152
+ 768,
1153
+ 512,
1154
+ 1
1155
+ ]
1156
+ },
1157
+ {
1158
+ "id": 92,
1159
+ "type": "IPAdapterUnifiedLoader",
1160
+ "pos": [
1161
+ 1539,
1162
+ 91
1163
+ ],
1164
+ "size": {
1165
+ "0": 315,
1166
+ "1": 78
1167
+ },
1168
+ "flags": {},
1169
+ "order": 7,
1170
+ "mode": 0,
1171
+ "inputs": [
1172
+ {
1173
+ "name": "model",
1174
+ "type": "MODEL",
1175
+ "link": 183
1176
+ },
1177
+ {
1178
+ "name": "ipadapter",
1179
+ "type": "IPADAPTER",
1180
+ "link": null
1181
+ }
1182
+ ],
1183
+ "outputs": [
1184
+ {
1185
+ "name": "model",
1186
+ "type": "MODEL",
1187
+ "links": [
1188
+ 184
1189
+ ],
1190
+ "shape": 3,
1191
+ "slot_index": 0
1192
+ },
1193
+ {
1194
+ "name": "ipadapter",
1195
+ "type": "IPADAPTER",
1196
+ "links": [
1197
+ 182
1198
+ ],
1199
+ "shape": 3
1200
+ }
1201
+ ],
1202
+ "properties": {
1203
+ "Node name for S&R": "IPAdapterUnifiedLoader"
1204
+ },
1205
+ "widgets_values": [
1206
+ "PLUS (high strength)"
1207
+ ]
1208
+ }
1209
+ ],
1210
+ "links": [
1211
+ [
1212
+ 5,
1213
+ 4,
1214
+ 1,
1215
+ 7,
1216
+ 0,
1217
+ "CLIP"
1218
+ ],
1219
+ [
1220
+ 7,
1221
+ 3,
1222
+ 0,
1223
+ 8,
1224
+ 0,
1225
+ "LATENT"
1226
+ ],
1227
+ [
1228
+ 8,
1229
+ 4,
1230
+ 2,
1231
+ 8,
1232
+ 1,
1233
+ "VAE"
1234
+ ],
1235
+ [
1236
+ 12,
1237
+ 8,
1238
+ 0,
1239
+ 18,
1240
+ 0,
1241
+ "IMAGE"
1242
+ ],
1243
+ [
1244
+ 57,
1245
+ 4,
1246
+ 1,
1247
+ 41,
1248
+ 0,
1249
+ "CLIP"
1250
+ ],
1251
+ [
1252
+ 149,
1253
+ 68,
1254
+ 0,
1255
+ 3,
1256
+ 3,
1257
+ "LATENT"
1258
+ ],
1259
+ [
1260
+ 150,
1261
+ 72,
1262
+ 0,
1263
+ 73,
1264
+ 0,
1265
+ "IMAGE"
1266
+ ],
1267
+ [
1268
+ 156,
1269
+ 69,
1270
+ 0,
1271
+ 79,
1272
+ 0,
1273
+ "IMAGE"
1274
+ ],
1275
+ [
1276
+ 157,
1277
+ 73,
1278
+ 1,
1279
+ 79,
1280
+ 1,
1281
+ "MASK"
1282
+ ],
1283
+ [
1284
+ 158,
1285
+ 70,
1286
+ 0,
1287
+ 80,
1288
+ 0,
1289
+ "IMAGE"
1290
+ ],
1291
+ [
1292
+ 159,
1293
+ 73,
1294
+ 0,
1295
+ 80,
1296
+ 1,
1297
+ "MASK"
1298
+ ],
1299
+ [
1300
+ 160,
1301
+ 71,
1302
+ 0,
1303
+ 81,
1304
+ 0,
1305
+ "IMAGE"
1306
+ ],
1307
+ [
1308
+ 161,
1309
+ 73,
1310
+ 6,
1311
+ 81,
1312
+ 1,
1313
+ "MASK"
1314
+ ],
1315
+ [
1316
+ 162,
1317
+ 4,
1318
+ 1,
1319
+ 83,
1320
+ 0,
1321
+ "CLIP"
1322
+ ],
1323
+ [
1324
+ 163,
1325
+ 83,
1326
+ 0,
1327
+ 79,
1328
+ 2,
1329
+ "CONDITIONING"
1330
+ ],
1331
+ [
1332
+ 164,
1333
+ 4,
1334
+ 1,
1335
+ 84,
1336
+ 0,
1337
+ "CLIP"
1338
+ ],
1339
+ [
1340
+ 165,
1341
+ 84,
1342
+ 0,
1343
+ 79,
1344
+ 3,
1345
+ "CONDITIONING"
1346
+ ],
1347
+ [
1348
+ 166,
1349
+ 4,
1350
+ 1,
1351
+ 85,
1352
+ 0,
1353
+ "CLIP"
1354
+ ],
1355
+ [
1356
+ 167,
1357
+ 4,
1358
+ 1,
1359
+ 86,
1360
+ 0,
1361
+ "CLIP"
1362
+ ],
1363
+ [
1364
+ 168,
1365
+ 85,
1366
+ 0,
1367
+ 80,
1368
+ 2,
1369
+ "CONDITIONING"
1370
+ ],
1371
+ [
1372
+ 169,
1373
+ 86,
1374
+ 0,
1375
+ 80,
1376
+ 3,
1377
+ "CONDITIONING"
1378
+ ],
1379
+ [
1380
+ 170,
1381
+ 79,
1382
+ 0,
1383
+ 87,
1384
+ 0,
1385
+ "IPADAPTER_PARAMS"
1386
+ ],
1387
+ [
1388
+ 171,
1389
+ 80,
1390
+ 0,
1391
+ 87,
1392
+ 1,
1393
+ "IPADAPTER_PARAMS"
1394
+ ],
1395
+ [
1396
+ 172,
1397
+ 81,
1398
+ 0,
1399
+ 87,
1400
+ 2,
1401
+ "IPADAPTER_PARAMS"
1402
+ ],
1403
+ [
1404
+ 174,
1405
+ 79,
1406
+ 1,
1407
+ 88,
1408
+ 0,
1409
+ "CONDITIONING"
1410
+ ],
1411
+ [
1412
+ 175,
1413
+ 80,
1414
+ 1,
1415
+ 88,
1416
+ 1,
1417
+ "CONDITIONING"
1418
+ ],
1419
+ [
1420
+ 176,
1421
+ 41,
1422
+ 0,
1423
+ 88,
1424
+ 2,
1425
+ "CONDITIONING"
1426
+ ],
1427
+ [
1428
+ 177,
1429
+ 79,
1430
+ 2,
1431
+ 89,
1432
+ 0,
1433
+ "CONDITIONING"
1434
+ ],
1435
+ [
1436
+ 178,
1437
+ 80,
1438
+ 2,
1439
+ 89,
1440
+ 1,
1441
+ "CONDITIONING"
1442
+ ],
1443
+ [
1444
+ 179,
1445
+ 7,
1446
+ 0,
1447
+ 89,
1448
+ 2,
1449
+ "CONDITIONING"
1450
+ ],
1451
+ [
1452
+ 181,
1453
+ 87,
1454
+ 0,
1455
+ 91,
1456
+ 2,
1457
+ "IPADAPTER_PARAMS"
1458
+ ],
1459
+ [
1460
+ 182,
1461
+ 92,
1462
+ 1,
1463
+ 91,
1464
+ 1,
1465
+ "IPADAPTER"
1466
+ ],
1467
+ [
1468
+ 183,
1469
+ 4,
1470
+ 0,
1471
+ 92,
1472
+ 0,
1473
+ "MODEL"
1474
+ ],
1475
+ [
1476
+ 184,
1477
+ 92,
1478
+ 0,
1479
+ 91,
1480
+ 0,
1481
+ "MODEL"
1482
+ ],
1483
+ [
1484
+ 185,
1485
+ 91,
1486
+ 0,
1487
+ 3,
1488
+ 0,
1489
+ "MODEL"
1490
+ ],
1491
+ [
1492
+ 186,
1493
+ 88,
1494
+ 0,
1495
+ 3,
1496
+ 1,
1497
+ "CONDITIONING"
1498
+ ],
1499
+ [
1500
+ 187,
1501
+ 89,
1502
+ 0,
1503
+ 3,
1504
+ 2,
1505
+ "CONDITIONING"
1506
+ ]
1507
+ ],
1508
+ "groups": [],
1509
+ "config": {},
1510
+ "extra": {},
1511
+ "version": 0.4
1512
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_simple.json ADDED
@@ -0,0 +1,546 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 13,
3
+ "last_link_id": 17,
4
+ "nodes": [
5
+ {
6
+ "id": 11,
7
+ "type": "IPAdapterUnifiedLoader",
8
+ "pos": [
9
+ 440,
10
+ 440
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 78
15
+ },
16
+ "flags": {},
17
+ "order": 3,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "model",
22
+ "type": "MODEL",
23
+ "link": 10
24
+ },
25
+ {
26
+ "name": "ipadapter",
27
+ "type": "IPADAPTER",
28
+ "link": null
29
+ }
30
+ ],
31
+ "outputs": [
32
+ {
33
+ "name": "model",
34
+ "type": "MODEL",
35
+ "links": [
36
+ 11
37
+ ],
38
+ "shape": 3,
39
+ "slot_index": 0
40
+ },
41
+ {
42
+ "name": "ipadapter",
43
+ "type": "IPADAPTER",
44
+ "links": [
45
+ 12
46
+ ],
47
+ "shape": 3,
48
+ "slot_index": 1
49
+ }
50
+ ],
51
+ "properties": {
52
+ "Node name for S&R": "IPAdapterUnifiedLoader"
53
+ },
54
+ "widgets_values": [
55
+ "PLUS (high strength)"
56
+ ]
57
+ },
58
+ {
59
+ "id": 4,
60
+ "type": "CheckpointLoaderSimple",
61
+ "pos": [
62
+ 50,
63
+ 730
64
+ ],
65
+ "size": {
66
+ "0": 315,
67
+ "1": 98
68
+ },
69
+ "flags": {},
70
+ "order": 0,
71
+ "mode": 0,
72
+ "outputs": [
73
+ {
74
+ "name": "MODEL",
75
+ "type": "MODEL",
76
+ "links": [
77
+ 10
78
+ ],
79
+ "slot_index": 0
80
+ },
81
+ {
82
+ "name": "CLIP",
83
+ "type": "CLIP",
84
+ "links": [
85
+ 3,
86
+ 5
87
+ ],
88
+ "slot_index": 1
89
+ },
90
+ {
91
+ "name": "VAE",
92
+ "type": "VAE",
93
+ "links": [
94
+ 8
95
+ ],
96
+ "slot_index": 2
97
+ }
98
+ ],
99
+ "properties": {
100
+ "Node name for S&R": "CheckpointLoaderSimple"
101
+ },
102
+ "widgets_values": [
103
+ "sd15/realisticVisionV51_v51VAE.safetensors"
104
+ ]
105
+ },
106
+ {
107
+ "id": 12,
108
+ "type": "LoadImage",
109
+ "pos": [
110
+ 440,
111
+ 60
112
+ ],
113
+ "size": [
114
+ 315,
115
+ 314
116
+ ],
117
+ "flags": {},
118
+ "order": 1,
119
+ "mode": 0,
120
+ "outputs": [
121
+ {
122
+ "name": "IMAGE",
123
+ "type": "IMAGE",
124
+ "links": [
125
+ 17
126
+ ],
127
+ "shape": 3
128
+ },
129
+ {
130
+ "name": "MASK",
131
+ "type": "MASK",
132
+ "links": null,
133
+ "shape": 3
134
+ }
135
+ ],
136
+ "properties": {
137
+ "Node name for S&R": "LoadImage"
138
+ },
139
+ "widgets_values": [
140
+ "warrior_woman.png",
141
+ "image"
142
+ ]
143
+ },
144
+ {
145
+ "id": 3,
146
+ "type": "KSampler",
147
+ "pos": [
148
+ 1210,
149
+ 700
150
+ ],
151
+ "size": {
152
+ "0": 315,
153
+ "1": 262
154
+ },
155
+ "flags": {},
156
+ "order": 7,
157
+ "mode": 0,
158
+ "inputs": [
159
+ {
160
+ "name": "model",
161
+ "type": "MODEL",
162
+ "link": 13
163
+ },
164
+ {
165
+ "name": "positive",
166
+ "type": "CONDITIONING",
167
+ "link": 4
168
+ },
169
+ {
170
+ "name": "negative",
171
+ "type": "CONDITIONING",
172
+ "link": 6
173
+ },
174
+ {
175
+ "name": "latent_image",
176
+ "type": "LATENT",
177
+ "link": 2
178
+ }
179
+ ],
180
+ "outputs": [
181
+ {
182
+ "name": "LATENT",
183
+ "type": "LATENT",
184
+ "links": [
185
+ 7
186
+ ],
187
+ "slot_index": 0
188
+ }
189
+ ],
190
+ "properties": {
191
+ "Node name for S&R": "KSampler"
192
+ },
193
+ "widgets_values": [
194
+ 0,
195
+ "fixed",
196
+ 30,
197
+ 6.5,
198
+ "dpmpp_2m",
199
+ "karras",
200
+ 1
201
+ ]
202
+ },
203
+ {
204
+ "id": 6,
205
+ "type": "CLIPTextEncode",
206
+ "pos": [
207
+ 690,
208
+ 610
209
+ ],
210
+ "size": {
211
+ "0": 422.84503173828125,
212
+ "1": 164.31304931640625
213
+ },
214
+ "flags": {},
215
+ "order": 4,
216
+ "mode": 0,
217
+ "inputs": [
218
+ {
219
+ "name": "clip",
220
+ "type": "CLIP",
221
+ "link": 3
222
+ }
223
+ ],
224
+ "outputs": [
225
+ {
226
+ "name": "CONDITIONING",
227
+ "type": "CONDITIONING",
228
+ "links": [
229
+ 4
230
+ ],
231
+ "slot_index": 0
232
+ }
233
+ ],
234
+ "properties": {
235
+ "Node name for S&R": "CLIPTextEncode"
236
+ },
237
+ "widgets_values": [
238
+ "closeup of a fierce warrior woman wearing a full armor at the end of a battle\n\nhigh quality, detailed"
239
+ ]
240
+ },
241
+ {
242
+ "id": 10,
243
+ "type": "IPAdapter",
244
+ "pos": [
245
+ 820,
246
+ 350
247
+ ],
248
+ "size": {
249
+ "0": 315,
250
+ "1": 166
251
+ },
252
+ "flags": {},
253
+ "order": 6,
254
+ "mode": 0,
255
+ "inputs": [
256
+ {
257
+ "name": "model",
258
+ "type": "MODEL",
259
+ "link": 11
260
+ },
261
+ {
262
+ "name": "ipadapter",
263
+ "type": "IPADAPTER",
264
+ "link": 12
265
+ },
266
+ {
267
+ "name": "image",
268
+ "type": "IMAGE",
269
+ "link": 17,
270
+ "slot_index": 2
271
+ },
272
+ {
273
+ "name": "attn_mask",
274
+ "type": "MASK",
275
+ "link": null
276
+ }
277
+ ],
278
+ "outputs": [
279
+ {
280
+ "name": "MODEL",
281
+ "type": "MODEL",
282
+ "links": [
283
+ 13
284
+ ],
285
+ "shape": 3,
286
+ "slot_index": 0
287
+ }
288
+ ],
289
+ "properties": {
290
+ "Node name for S&R": "IPAdapter"
291
+ },
292
+ "widgets_values": [
293
+ 0.8,
294
+ 0,
295
+ 1
296
+ ]
297
+ },
298
+ {
299
+ "id": 9,
300
+ "type": "SaveImage",
301
+ "pos": [
302
+ 1770,
303
+ 710
304
+ ],
305
+ "size": [
306
+ 529.7760009765616,
307
+ 582.3048192804504
308
+ ],
309
+ "flags": {},
310
+ "order": 9,
311
+ "mode": 0,
312
+ "inputs": [
313
+ {
314
+ "name": "images",
315
+ "type": "IMAGE",
316
+ "link": 9
317
+ }
318
+ ],
319
+ "properties": {},
320
+ "widgets_values": [
321
+ "IPAdapter"
322
+ ]
323
+ },
324
+ {
325
+ "id": 7,
326
+ "type": "CLIPTextEncode",
327
+ "pos": [
328
+ 690,
329
+ 840
330
+ ],
331
+ "size": {
332
+ "0": 425.27801513671875,
333
+ "1": 180.6060791015625
334
+ },
335
+ "flags": {},
336
+ "order": 5,
337
+ "mode": 0,
338
+ "inputs": [
339
+ {
340
+ "name": "clip",
341
+ "type": "CLIP",
342
+ "link": 5
343
+ }
344
+ ],
345
+ "outputs": [
346
+ {
347
+ "name": "CONDITIONING",
348
+ "type": "CONDITIONING",
349
+ "links": [
350
+ 6
351
+ ],
352
+ "slot_index": 0
353
+ }
354
+ ],
355
+ "properties": {
356
+ "Node name for S&R": "CLIPTextEncode"
357
+ },
358
+ "widgets_values": [
359
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
360
+ ]
361
+ },
362
+ {
363
+ "id": 8,
364
+ "type": "VAEDecode",
365
+ "pos": [
366
+ 1570,
367
+ 700
368
+ ],
369
+ "size": [
370
+ 140,
371
+ 46
372
+ ],
373
+ "flags": {},
374
+ "order": 8,
375
+ "mode": 0,
376
+ "inputs": [
377
+ {
378
+ "name": "samples",
379
+ "type": "LATENT",
380
+ "link": 7
381
+ },
382
+ {
383
+ "name": "vae",
384
+ "type": "VAE",
385
+ "link": 8
386
+ }
387
+ ],
388
+ "outputs": [
389
+ {
390
+ "name": "IMAGE",
391
+ "type": "IMAGE",
392
+ "links": [
393
+ 9
394
+ ],
395
+ "slot_index": 0
396
+ }
397
+ ],
398
+ "properties": {
399
+ "Node name for S&R": "VAEDecode"
400
+ }
401
+ },
402
+ {
403
+ "id": 5,
404
+ "type": "EmptyLatentImage",
405
+ "pos": [
406
+ 801,
407
+ 1097
408
+ ],
409
+ "size": {
410
+ "0": 315,
411
+ "1": 106
412
+ },
413
+ "flags": {},
414
+ "order": 2,
415
+ "mode": 0,
416
+ "outputs": [
417
+ {
418
+ "name": "LATENT",
419
+ "type": "LATENT",
420
+ "links": [
421
+ 2
422
+ ],
423
+ "slot_index": 0
424
+ }
425
+ ],
426
+ "properties": {
427
+ "Node name for S&R": "EmptyLatentImage"
428
+ },
429
+ "widgets_values": [
430
+ 512,
431
+ 512,
432
+ 1
433
+ ]
434
+ }
435
+ ],
436
+ "links": [
437
+ [
438
+ 2,
439
+ 5,
440
+ 0,
441
+ 3,
442
+ 3,
443
+ "LATENT"
444
+ ],
445
+ [
446
+ 3,
447
+ 4,
448
+ 1,
449
+ 6,
450
+ 0,
451
+ "CLIP"
452
+ ],
453
+ [
454
+ 4,
455
+ 6,
456
+ 0,
457
+ 3,
458
+ 1,
459
+ "CONDITIONING"
460
+ ],
461
+ [
462
+ 5,
463
+ 4,
464
+ 1,
465
+ 7,
466
+ 0,
467
+ "CLIP"
468
+ ],
469
+ [
470
+ 6,
471
+ 7,
472
+ 0,
473
+ 3,
474
+ 2,
475
+ "CONDITIONING"
476
+ ],
477
+ [
478
+ 7,
479
+ 3,
480
+ 0,
481
+ 8,
482
+ 0,
483
+ "LATENT"
484
+ ],
485
+ [
486
+ 8,
487
+ 4,
488
+ 2,
489
+ 8,
490
+ 1,
491
+ "VAE"
492
+ ],
493
+ [
494
+ 9,
495
+ 8,
496
+ 0,
497
+ 9,
498
+ 0,
499
+ "IMAGE"
500
+ ],
501
+ [
502
+ 10,
503
+ 4,
504
+ 0,
505
+ 11,
506
+ 0,
507
+ "MODEL"
508
+ ],
509
+ [
510
+ 11,
511
+ 11,
512
+ 0,
513
+ 10,
514
+ 0,
515
+ "MODEL"
516
+ ],
517
+ [
518
+ 12,
519
+ 11,
520
+ 1,
521
+ 10,
522
+ 1,
523
+ "IPADAPTER"
524
+ ],
525
+ [
526
+ 13,
527
+ 10,
528
+ 0,
529
+ 3,
530
+ 0,
531
+ "MODEL"
532
+ ],
533
+ [
534
+ 17,
535
+ 12,
536
+ 0,
537
+ 10,
538
+ 2,
539
+ "IMAGE"
540
+ ]
541
+ ],
542
+ "groups": [],
543
+ "config": {},
544
+ "extra": {},
545
+ "version": 0.4
546
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_style_composition.json ADDED
@@ -0,0 +1,612 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 16,
3
+ "last_link_id": 25,
4
+ "nodes": [
5
+ {
6
+ "id": 7,
7
+ "type": "CLIPTextEncode",
8
+ "pos": [
9
+ 690,
10
+ 840
11
+ ],
12
+ "size": {
13
+ "0": 425.27801513671875,
14
+ "1": 180.6060791015625
15
+ },
16
+ "flags": {},
17
+ "order": 6,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "clip",
22
+ "type": "CLIP",
23
+ "link": 5
24
+ }
25
+ ],
26
+ "outputs": [
27
+ {
28
+ "name": "CONDITIONING",
29
+ "type": "CONDITIONING",
30
+ "links": [
31
+ 6
32
+ ],
33
+ "slot_index": 0
34
+ }
35
+ ],
36
+ "properties": {
37
+ "Node name for S&R": "CLIPTextEncode"
38
+ },
39
+ "widgets_values": [
40
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
41
+ ]
42
+ },
43
+ {
44
+ "id": 11,
45
+ "type": "IPAdapterUnifiedLoader",
46
+ "pos": [
47
+ 335,
48
+ 430
49
+ ],
50
+ "size": {
51
+ "0": 315,
52
+ "1": 78
53
+ },
54
+ "flags": {},
55
+ "order": 4,
56
+ "mode": 0,
57
+ "inputs": [
58
+ {
59
+ "name": "model",
60
+ "type": "MODEL",
61
+ "link": 10
62
+ },
63
+ {
64
+ "name": "ipadapter",
65
+ "type": "IPADAPTER",
66
+ "link": null
67
+ }
68
+ ],
69
+ "outputs": [
70
+ {
71
+ "name": "model",
72
+ "type": "MODEL",
73
+ "links": [
74
+ 21
75
+ ],
76
+ "shape": 3,
77
+ "slot_index": 0
78
+ },
79
+ {
80
+ "name": "ipadapter",
81
+ "type": "IPADAPTER",
82
+ "links": [
83
+ 22
84
+ ],
85
+ "shape": 3,
86
+ "slot_index": 1
87
+ }
88
+ ],
89
+ "properties": {
90
+ "Node name for S&R": "IPAdapterUnifiedLoader"
91
+ },
92
+ "widgets_values": [
93
+ "PLUS (high strength)"
94
+ ]
95
+ },
96
+ {
97
+ "id": 12,
98
+ "type": "LoadImage",
99
+ "pos": [
100
+ -102,
101
+ -46
102
+ ],
103
+ "size": {
104
+ "0": 315,
105
+ "1": 314
106
+ },
107
+ "flags": {},
108
+ "order": 0,
109
+ "mode": 0,
110
+ "outputs": [
111
+ {
112
+ "name": "IMAGE",
113
+ "type": "IMAGE",
114
+ "links": [
115
+ 25
116
+ ],
117
+ "shape": 3,
118
+ "slot_index": 0
119
+ },
120
+ {
121
+ "name": "MASK",
122
+ "type": "MASK",
123
+ "links": null,
124
+ "shape": 3
125
+ }
126
+ ],
127
+ "properties": {
128
+ "Node name for S&R": "LoadImage"
129
+ },
130
+ "widgets_values": [
131
+ "black_car.jpg",
132
+ "image"
133
+ ]
134
+ },
135
+ {
136
+ "id": 16,
137
+ "type": "LoadImage",
138
+ "pos": [
139
+ 310,
140
+ -40
141
+ ],
142
+ "size": {
143
+ "0": 315,
144
+ "1": 314
145
+ },
146
+ "flags": {},
147
+ "order": 1,
148
+ "mode": 0,
149
+ "outputs": [
150
+ {
151
+ "name": "IMAGE",
152
+ "type": "IMAGE",
153
+ "links": [
154
+ 24
155
+ ],
156
+ "shape": 3,
157
+ "slot_index": 0
158
+ },
159
+ {
160
+ "name": "MASK",
161
+ "type": "MASK",
162
+ "links": null,
163
+ "shape": 3
164
+ }
165
+ ],
166
+ "properties": {
167
+ "Node name for S&R": "LoadImage"
168
+ },
169
+ "widgets_values": [
170
+ "bw_texture_waves.jpg",
171
+ "image"
172
+ ]
173
+ },
174
+ {
175
+ "id": 5,
176
+ "type": "EmptyLatentImage",
177
+ "pos": [
178
+ 801,
179
+ 1097
180
+ ],
181
+ "size": {
182
+ "0": 315,
183
+ "1": 106
184
+ },
185
+ "flags": {},
186
+ "order": 2,
187
+ "mode": 0,
188
+ "outputs": [
189
+ {
190
+ "name": "LATENT",
191
+ "type": "LATENT",
192
+ "links": [
193
+ 2
194
+ ],
195
+ "slot_index": 0
196
+ }
197
+ ],
198
+ "properties": {
199
+ "Node name for S&R": "EmptyLatentImage"
200
+ },
201
+ "widgets_values": [
202
+ 1024,
203
+ 1024,
204
+ 1
205
+ ]
206
+ },
207
+ {
208
+ "id": 6,
209
+ "type": "CLIPTextEncode",
210
+ "pos": [
211
+ 690,
212
+ 610
213
+ ],
214
+ "size": {
215
+ "0": 422.84503173828125,
216
+ "1": 164.31304931640625
217
+ },
218
+ "flags": {},
219
+ "order": 5,
220
+ "mode": 0,
221
+ "inputs": [
222
+ {
223
+ "name": "clip",
224
+ "type": "CLIP",
225
+ "link": 3
226
+ }
227
+ ],
228
+ "outputs": [
229
+ {
230
+ "name": "CONDITIONING",
231
+ "type": "CONDITIONING",
232
+ "links": [
233
+ 4
234
+ ],
235
+ "slot_index": 0
236
+ }
237
+ ],
238
+ "properties": {
239
+ "Node name for S&R": "CLIPTextEncode"
240
+ },
241
+ "widgets_values": [
242
+ "sports car running fast on the highway\n\nhigh quality, detailed"
243
+ ]
244
+ },
245
+ {
246
+ "id": 15,
247
+ "type": "IPAdapterStyleComposition",
248
+ "pos": [
249
+ 772,
250
+ 219
251
+ ],
252
+ "size": {
253
+ "0": 315,
254
+ "1": 322
255
+ },
256
+ "flags": {},
257
+ "order": 7,
258
+ "mode": 0,
259
+ "inputs": [
260
+ {
261
+ "name": "model",
262
+ "type": "MODEL",
263
+ "link": 21
264
+ },
265
+ {
266
+ "name": "ipadapter",
267
+ "type": "IPADAPTER",
268
+ "link": 22
269
+ },
270
+ {
271
+ "name": "image_style",
272
+ "type": "IMAGE",
273
+ "link": 24
274
+ },
275
+ {
276
+ "name": "image_composition",
277
+ "type": "IMAGE",
278
+ "link": 25
279
+ },
280
+ {
281
+ "name": "image_negative",
282
+ "type": "IMAGE",
283
+ "link": null
284
+ },
285
+ {
286
+ "name": "attn_mask",
287
+ "type": "MASK",
288
+ "link": null
289
+ },
290
+ {
291
+ "name": "clip_vision",
292
+ "type": "CLIP_VISION",
293
+ "link": null
294
+ }
295
+ ],
296
+ "outputs": [
297
+ {
298
+ "name": "MODEL",
299
+ "type": "MODEL",
300
+ "links": [
301
+ 23
302
+ ],
303
+ "shape": 3,
304
+ "slot_index": 0
305
+ }
306
+ ],
307
+ "properties": {
308
+ "Node name for S&R": "IPAdapterStyleComposition"
309
+ },
310
+ "widgets_values": [
311
+ 1.2,
312
+ 1,
313
+ false,
314
+ "average",
315
+ 0,
316
+ 1,
317
+ "V only"
318
+ ]
319
+ },
320
+ {
321
+ "id": 3,
322
+ "type": "KSampler",
323
+ "pos": [
324
+ 1247,
325
+ 586
326
+ ],
327
+ "size": {
328
+ "0": 315,
329
+ "1": 262
330
+ },
331
+ "flags": {},
332
+ "order": 8,
333
+ "mode": 0,
334
+ "inputs": [
335
+ {
336
+ "name": "model",
337
+ "type": "MODEL",
338
+ "link": 23
339
+ },
340
+ {
341
+ "name": "positive",
342
+ "type": "CONDITIONING",
343
+ "link": 4
344
+ },
345
+ {
346
+ "name": "negative",
347
+ "type": "CONDITIONING",
348
+ "link": 6
349
+ },
350
+ {
351
+ "name": "latent_image",
352
+ "type": "LATENT",
353
+ "link": 2
354
+ }
355
+ ],
356
+ "outputs": [
357
+ {
358
+ "name": "LATENT",
359
+ "type": "LATENT",
360
+ "links": [
361
+ 7
362
+ ],
363
+ "slot_index": 0
364
+ }
365
+ ],
366
+ "properties": {
367
+ "Node name for S&R": "KSampler"
368
+ },
369
+ "widgets_values": [
370
+ 0,
371
+ "fixed",
372
+ 30,
373
+ 6.5,
374
+ "dpmpp_2m",
375
+ "karras",
376
+ 1
377
+ ]
378
+ },
379
+ {
380
+ "id": 8,
381
+ "type": "VAEDecode",
382
+ "pos": [
383
+ 1615,
384
+ 586
385
+ ],
386
+ "size": {
387
+ "0": 140,
388
+ "1": 46
389
+ },
390
+ "flags": {},
391
+ "order": 9,
392
+ "mode": 0,
393
+ "inputs": [
394
+ {
395
+ "name": "samples",
396
+ "type": "LATENT",
397
+ "link": 7
398
+ },
399
+ {
400
+ "name": "vae",
401
+ "type": "VAE",
402
+ "link": 8
403
+ }
404
+ ],
405
+ "outputs": [
406
+ {
407
+ "name": "IMAGE",
408
+ "type": "IMAGE",
409
+ "links": [
410
+ 9
411
+ ],
412
+ "slot_index": 0
413
+ }
414
+ ],
415
+ "properties": {
416
+ "Node name for S&R": "VAEDecode"
417
+ }
418
+ },
419
+ {
420
+ "id": 9,
421
+ "type": "SaveImage",
422
+ "pos": [
423
+ 1822,
424
+ 588
425
+ ],
426
+ "size": [
427
+ 691.0159878487498,
428
+ 716.6239849908982
429
+ ],
430
+ "flags": {},
431
+ "order": 10,
432
+ "mode": 0,
433
+ "inputs": [
434
+ {
435
+ "name": "images",
436
+ "type": "IMAGE",
437
+ "link": 9
438
+ }
439
+ ],
440
+ "properties": {},
441
+ "widgets_values": [
442
+ "IPAdapter"
443
+ ]
444
+ },
445
+ {
446
+ "id": 4,
447
+ "type": "CheckpointLoaderSimple",
448
+ "pos": [
449
+ -72,
450
+ 657
451
+ ],
452
+ "size": {
453
+ "0": 315,
454
+ "1": 98
455
+ },
456
+ "flags": {},
457
+ "order": 3,
458
+ "mode": 0,
459
+ "outputs": [
460
+ {
461
+ "name": "MODEL",
462
+ "type": "MODEL",
463
+ "links": [
464
+ 10
465
+ ],
466
+ "slot_index": 0
467
+ },
468
+ {
469
+ "name": "CLIP",
470
+ "type": "CLIP",
471
+ "links": [
472
+ 3,
473
+ 5
474
+ ],
475
+ "slot_index": 1
476
+ },
477
+ {
478
+ "name": "VAE",
479
+ "type": "VAE",
480
+ "links": [
481
+ 8
482
+ ],
483
+ "slot_index": 2
484
+ }
485
+ ],
486
+ "properties": {
487
+ "Node name for S&R": "CheckpointLoaderSimple"
488
+ },
489
+ "widgets_values": [
490
+ "sdxl/AlbedoBaseXL.safetensors"
491
+ ]
492
+ }
493
+ ],
494
+ "links": [
495
+ [
496
+ 2,
497
+ 5,
498
+ 0,
499
+ 3,
500
+ 3,
501
+ "LATENT"
502
+ ],
503
+ [
504
+ 3,
505
+ 4,
506
+ 1,
507
+ 6,
508
+ 0,
509
+ "CLIP"
510
+ ],
511
+ [
512
+ 4,
513
+ 6,
514
+ 0,
515
+ 3,
516
+ 1,
517
+ "CONDITIONING"
518
+ ],
519
+ [
520
+ 5,
521
+ 4,
522
+ 1,
523
+ 7,
524
+ 0,
525
+ "CLIP"
526
+ ],
527
+ [
528
+ 6,
529
+ 7,
530
+ 0,
531
+ 3,
532
+ 2,
533
+ "CONDITIONING"
534
+ ],
535
+ [
536
+ 7,
537
+ 3,
538
+ 0,
539
+ 8,
540
+ 0,
541
+ "LATENT"
542
+ ],
543
+ [
544
+ 8,
545
+ 4,
546
+ 2,
547
+ 8,
548
+ 1,
549
+ "VAE"
550
+ ],
551
+ [
552
+ 9,
553
+ 8,
554
+ 0,
555
+ 9,
556
+ 0,
557
+ "IMAGE"
558
+ ],
559
+ [
560
+ 10,
561
+ 4,
562
+ 0,
563
+ 11,
564
+ 0,
565
+ "MODEL"
566
+ ],
567
+ [
568
+ 21,
569
+ 11,
570
+ 0,
571
+ 15,
572
+ 0,
573
+ "MODEL"
574
+ ],
575
+ [
576
+ 22,
577
+ 11,
578
+ 1,
579
+ 15,
580
+ 1,
581
+ "IPADAPTER"
582
+ ],
583
+ [
584
+ 23,
585
+ 15,
586
+ 0,
587
+ 3,
588
+ 0,
589
+ "MODEL"
590
+ ],
591
+ [
592
+ 24,
593
+ 16,
594
+ 0,
595
+ 15,
596
+ 2,
597
+ "IMAGE"
598
+ ],
599
+ [
600
+ 25,
601
+ 12,
602
+ 0,
603
+ 15,
604
+ 3,
605
+ "IMAGE"
606
+ ]
607
+ ],
608
+ "groups": [],
609
+ "config": {},
610
+ "extra": {},
611
+ "version": 0.4
612
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_tiled.json ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 18,
3
+ "last_link_id": 32,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ 50,
10
+ 730
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 29
25
+ ],
26
+ "slot_index": 0
27
+ },
28
+ {
29
+ "name": "CLIP",
30
+ "type": "CLIP",
31
+ "links": [
32
+ 3,
33
+ 5
34
+ ],
35
+ "slot_index": 1
36
+ },
37
+ {
38
+ "name": "VAE",
39
+ "type": "VAE",
40
+ "links": [
41
+ 8
42
+ ],
43
+ "slot_index": 2
44
+ }
45
+ ],
46
+ "properties": {
47
+ "Node name for S&R": "CheckpointLoaderSimple"
48
+ },
49
+ "widgets_values": [
50
+ "sd15/realisticVisionV51_v51VAE.safetensors"
51
+ ]
52
+ },
53
+ {
54
+ "id": 7,
55
+ "type": "CLIPTextEncode",
56
+ "pos": [
57
+ 690,
58
+ 840
59
+ ],
60
+ "size": {
61
+ "0": 425.27801513671875,
62
+ "1": 180.6060791015625
63
+ },
64
+ "flags": {},
65
+ "order": 6,
66
+ "mode": 0,
67
+ "inputs": [
68
+ {
69
+ "name": "clip",
70
+ "type": "CLIP",
71
+ "link": 5
72
+ }
73
+ ],
74
+ "outputs": [
75
+ {
76
+ "name": "CONDITIONING",
77
+ "type": "CONDITIONING",
78
+ "links": [
79
+ 6
80
+ ],
81
+ "slot_index": 0
82
+ }
83
+ ],
84
+ "properties": {
85
+ "Node name for S&R": "CLIPTextEncode"
86
+ },
87
+ "widgets_values": [
88
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
89
+ ]
90
+ },
91
+ {
92
+ "id": 8,
93
+ "type": "VAEDecode",
94
+ "pos": [
95
+ 1570,
96
+ 700
97
+ ],
98
+ "size": {
99
+ "0": 140,
100
+ "1": 46
101
+ },
102
+ "flags": {},
103
+ "order": 9,
104
+ "mode": 0,
105
+ "inputs": [
106
+ {
107
+ "name": "samples",
108
+ "type": "LATENT",
109
+ "link": 7
110
+ },
111
+ {
112
+ "name": "vae",
113
+ "type": "VAE",
114
+ "link": 8
115
+ }
116
+ ],
117
+ "outputs": [
118
+ {
119
+ "name": "IMAGE",
120
+ "type": "IMAGE",
121
+ "links": [
122
+ 9
123
+ ],
124
+ "slot_index": 0
125
+ }
126
+ ],
127
+ "properties": {
128
+ "Node name for S&R": "VAEDecode"
129
+ }
130
+ },
131
+ {
132
+ "id": 12,
133
+ "type": "LoadImage",
134
+ "pos": [
135
+ 250,
136
+ 290
137
+ ],
138
+ "size": {
139
+ "0": 315,
140
+ "1": 314
141
+ },
142
+ "flags": {},
143
+ "order": 1,
144
+ "mode": 0,
145
+ "outputs": [
146
+ {
147
+ "name": "IMAGE",
148
+ "type": "IMAGE",
149
+ "links": [
150
+ 27
151
+ ],
152
+ "shape": 3,
153
+ "slot_index": 0
154
+ },
155
+ {
156
+ "name": "MASK",
157
+ "type": "MASK",
158
+ "links": null,
159
+ "shape": 3
160
+ }
161
+ ],
162
+ "properties": {
163
+ "Node name for S&R": "LoadImage"
164
+ },
165
+ "widgets_values": [
166
+ "girl_sitting.png",
167
+ "image"
168
+ ]
169
+ },
170
+ {
171
+ "id": 6,
172
+ "type": "CLIPTextEncode",
173
+ "pos": [
174
+ 690,
175
+ 610
176
+ ],
177
+ "size": {
178
+ "0": 422.84503173828125,
179
+ "1": 164.31304931640625
180
+ },
181
+ "flags": {},
182
+ "order": 5,
183
+ "mode": 0,
184
+ "inputs": [
185
+ {
186
+ "name": "clip",
187
+ "type": "CLIP",
188
+ "link": 3
189
+ }
190
+ ],
191
+ "outputs": [
192
+ {
193
+ "name": "CONDITIONING",
194
+ "type": "CONDITIONING",
195
+ "links": [
196
+ 4
197
+ ],
198
+ "slot_index": 0
199
+ }
200
+ ],
201
+ "properties": {
202
+ "Node name for S&R": "CLIPTextEncode"
203
+ },
204
+ "widgets_values": [
205
+ "in a peaceful spring morning a woman wearing a white shirt is sitting in a park on a bench\n\nhigh quality, detailed, diffuse light"
206
+ ]
207
+ },
208
+ {
209
+ "id": 5,
210
+ "type": "EmptyLatentImage",
211
+ "pos": [
212
+ 801,
213
+ 1097
214
+ ],
215
+ "size": {
216
+ "0": 315,
217
+ "1": 106
218
+ },
219
+ "flags": {},
220
+ "order": 2,
221
+ "mode": 0,
222
+ "outputs": [
223
+ {
224
+ "name": "LATENT",
225
+ "type": "LATENT",
226
+ "links": [
227
+ 2
228
+ ],
229
+ "slot_index": 0
230
+ }
231
+ ],
232
+ "properties": {
233
+ "Node name for S&R": "EmptyLatentImage"
234
+ },
235
+ "widgets_values": [
236
+ 512,
237
+ 768,
238
+ 1
239
+ ]
240
+ },
241
+ {
242
+ "id": 3,
243
+ "type": "KSampler",
244
+ "pos": [
245
+ 1210,
246
+ 700
247
+ ],
248
+ "size": {
249
+ "0": 315,
250
+ "1": 262
251
+ },
252
+ "flags": {},
253
+ "order": 8,
254
+ "mode": 0,
255
+ "inputs": [
256
+ {
257
+ "name": "model",
258
+ "type": "MODEL",
259
+ "link": 30
260
+ },
261
+ {
262
+ "name": "positive",
263
+ "type": "CONDITIONING",
264
+ "link": 4
265
+ },
266
+ {
267
+ "name": "negative",
268
+ "type": "CONDITIONING",
269
+ "link": 6
270
+ },
271
+ {
272
+ "name": "latent_image",
273
+ "type": "LATENT",
274
+ "link": 2
275
+ }
276
+ ],
277
+ "outputs": [
278
+ {
279
+ "name": "LATENT",
280
+ "type": "LATENT",
281
+ "links": [
282
+ 7
283
+ ],
284
+ "slot_index": 0
285
+ }
286
+ ],
287
+ "properties": {
288
+ "Node name for S&R": "KSampler"
289
+ },
290
+ "widgets_values": [
291
+ 2,
292
+ "fixed",
293
+ 30,
294
+ 6.5,
295
+ "ddpm",
296
+ "karras",
297
+ 1
298
+ ]
299
+ },
300
+ {
301
+ "id": 18,
302
+ "type": "IPAdapterTiled",
303
+ "pos": [
304
+ 700,
305
+ 230
306
+ ],
307
+ "size": {
308
+ "0": 315,
309
+ "1": 302
310
+ },
311
+ "flags": {},
312
+ "order": 7,
313
+ "mode": 0,
314
+ "inputs": [
315
+ {
316
+ "name": "model",
317
+ "type": "MODEL",
318
+ "link": 29
319
+ },
320
+ {
321
+ "name": "ipadapter",
322
+ "type": "IPADAPTER",
323
+ "link": 31
324
+ },
325
+ {
326
+ "name": "image",
327
+ "type": "IMAGE",
328
+ "link": 27
329
+ },
330
+ {
331
+ "name": "image_negative",
332
+ "type": "IMAGE",
333
+ "link": null
334
+ },
335
+ {
336
+ "name": "attn_mask",
337
+ "type": "MASK",
338
+ "link": null
339
+ },
340
+ {
341
+ "name": "clip_vision",
342
+ "type": "CLIP_VISION",
343
+ "link": 32
344
+ }
345
+ ],
346
+ "outputs": [
347
+ {
348
+ "name": "MODEL",
349
+ "type": "MODEL",
350
+ "links": [
351
+ 30
352
+ ],
353
+ "shape": 3,
354
+ "slot_index": 0
355
+ },
356
+ {
357
+ "name": "tiles",
358
+ "type": "IMAGE",
359
+ "links": null,
360
+ "shape": 3
361
+ },
362
+ {
363
+ "name": "masks",
364
+ "type": "MASK",
365
+ "links": null,
366
+ "shape": 3
367
+ }
368
+ ],
369
+ "properties": {
370
+ "Node name for S&R": "IPAdapterTiled"
371
+ },
372
+ "widgets_values": [
373
+ 0.7000000000000001,
374
+ "ease in",
375
+ "concat",
376
+ 0,
377
+ 1,
378
+ 0,
379
+ "V only"
380
+ ]
381
+ },
382
+ {
383
+ "id": 9,
384
+ "type": "SaveImage",
385
+ "pos": [
386
+ 1768,
387
+ 700
388
+ ],
389
+ "size": {
390
+ "0": 529.7760009765625,
391
+ "1": 582.3048095703125
392
+ },
393
+ "flags": {},
394
+ "order": 10,
395
+ "mode": 0,
396
+ "inputs": [
397
+ {
398
+ "name": "images",
399
+ "type": "IMAGE",
400
+ "link": 9
401
+ }
402
+ ],
403
+ "properties": {},
404
+ "widgets_values": [
405
+ "IPAdapter"
406
+ ]
407
+ },
408
+ {
409
+ "id": 15,
410
+ "type": "IPAdapterModelLoader",
411
+ "pos": [
412
+ 250,
413
+ 70
414
+ ],
415
+ "size": {
416
+ "0": 315,
417
+ "1": 58
418
+ },
419
+ "flags": {},
420
+ "order": 3,
421
+ "mode": 0,
422
+ "outputs": [
423
+ {
424
+ "name": "IPADAPTER",
425
+ "type": "IPADAPTER",
426
+ "links": [
427
+ 31
428
+ ],
429
+ "shape": 3,
430
+ "slot_index": 0
431
+ }
432
+ ],
433
+ "properties": {
434
+ "Node name for S&R": "IPAdapterModelLoader"
435
+ },
436
+ "widgets_values": [
437
+ "ip-adapter-plus_sd15.safetensors"
438
+ ]
439
+ },
440
+ {
441
+ "id": 16,
442
+ "type": "CLIPVisionLoader",
443
+ "pos": [
444
+ 250,
445
+ 180
446
+ ],
447
+ "size": {
448
+ "0": 315,
449
+ "1": 58
450
+ },
451
+ "flags": {},
452
+ "order": 4,
453
+ "mode": 0,
454
+ "outputs": [
455
+ {
456
+ "name": "CLIP_VISION",
457
+ "type": "CLIP_VISION",
458
+ "links": [
459
+ 32
460
+ ],
461
+ "shape": 3,
462
+ "slot_index": 0
463
+ }
464
+ ],
465
+ "properties": {
466
+ "Node name for S&R": "CLIPVisionLoader"
467
+ },
468
+ "widgets_values": [
469
+ "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors"
470
+ ]
471
+ }
472
+ ],
473
+ "links": [
474
+ [
475
+ 2,
476
+ 5,
477
+ 0,
478
+ 3,
479
+ 3,
480
+ "LATENT"
481
+ ],
482
+ [
483
+ 3,
484
+ 4,
485
+ 1,
486
+ 6,
487
+ 0,
488
+ "CLIP"
489
+ ],
490
+ [
491
+ 4,
492
+ 6,
493
+ 0,
494
+ 3,
495
+ 1,
496
+ "CONDITIONING"
497
+ ],
498
+ [
499
+ 5,
500
+ 4,
501
+ 1,
502
+ 7,
503
+ 0,
504
+ "CLIP"
505
+ ],
506
+ [
507
+ 6,
508
+ 7,
509
+ 0,
510
+ 3,
511
+ 2,
512
+ "CONDITIONING"
513
+ ],
514
+ [
515
+ 7,
516
+ 3,
517
+ 0,
518
+ 8,
519
+ 0,
520
+ "LATENT"
521
+ ],
522
+ [
523
+ 8,
524
+ 4,
525
+ 2,
526
+ 8,
527
+ 1,
528
+ "VAE"
529
+ ],
530
+ [
531
+ 9,
532
+ 8,
533
+ 0,
534
+ 9,
535
+ 0,
536
+ "IMAGE"
537
+ ],
538
+ [
539
+ 27,
540
+ 12,
541
+ 0,
542
+ 18,
543
+ 2,
544
+ "IMAGE"
545
+ ],
546
+ [
547
+ 29,
548
+ 4,
549
+ 0,
550
+ 18,
551
+ 0,
552
+ "MODEL"
553
+ ],
554
+ [
555
+ 30,
556
+ 18,
557
+ 0,
558
+ 3,
559
+ 0,
560
+ "MODEL"
561
+ ],
562
+ [
563
+ 31,
564
+ 15,
565
+ 0,
566
+ 18,
567
+ 1,
568
+ "IPADAPTER"
569
+ ],
570
+ [
571
+ 32,
572
+ 16,
573
+ 0,
574
+ 18,
575
+ 5,
576
+ "CLIP_VISION"
577
+ ]
578
+ ],
579
+ "groups": [],
580
+ "config": {},
581
+ "extra": {},
582
+ "version": 0.4
583
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_weight_types.json ADDED
@@ -0,0 +1,1738 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 37,
3
+ "last_link_id": 82,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ 50,
10
+ 730
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 20,
25
+ 35,
26
+ 46,
27
+ 57,
28
+ 68
29
+ ],
30
+ "slot_index": 0
31
+ },
32
+ {
33
+ "name": "CLIP",
34
+ "type": "CLIP",
35
+ "links": [
36
+ 3,
37
+ 5
38
+ ],
39
+ "slot_index": 1
40
+ },
41
+ {
42
+ "name": "VAE",
43
+ "type": "VAE",
44
+ "links": [
45
+ 8,
46
+ 33,
47
+ 44,
48
+ 55,
49
+ 66
50
+ ],
51
+ "slot_index": 2
52
+ }
53
+ ],
54
+ "properties": {
55
+ "Node name for S&R": "CheckpointLoaderSimple"
56
+ },
57
+ "widgets_values": [
58
+ "sd15/realisticVisionV51_v51VAE.safetensors"
59
+ ]
60
+ },
61
+ {
62
+ "id": 7,
63
+ "type": "CLIPTextEncode",
64
+ "pos": [
65
+ 690,
66
+ 840
67
+ ],
68
+ "size": {
69
+ "0": 425.27801513671875,
70
+ "1": 180.6060791015625
71
+ },
72
+ "flags": {},
73
+ "order": 6,
74
+ "mode": 0,
75
+ "inputs": [
76
+ {
77
+ "name": "clip",
78
+ "type": "CLIP",
79
+ "link": 5
80
+ }
81
+ ],
82
+ "outputs": [
83
+ {
84
+ "name": "CONDITIONING",
85
+ "type": "CONDITIONING",
86
+ "links": [
87
+ 6,
88
+ 30,
89
+ 41,
90
+ 52,
91
+ 63
92
+ ],
93
+ "slot_index": 0
94
+ }
95
+ ],
96
+ "properties": {
97
+ "Node name for S&R": "CLIPTextEncode"
98
+ },
99
+ "widgets_values": [
100
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
101
+ ]
102
+ },
103
+ {
104
+ "id": 5,
105
+ "type": "EmptyLatentImage",
106
+ "pos": [
107
+ 801,
108
+ 1097
109
+ ],
110
+ "size": {
111
+ "0": 315,
112
+ "1": 106
113
+ },
114
+ "flags": {},
115
+ "order": 1,
116
+ "mode": 0,
117
+ "outputs": [
118
+ {
119
+ "name": "LATENT",
120
+ "type": "LATENT",
121
+ "links": [
122
+ 2,
123
+ 31,
124
+ 42,
125
+ 53,
126
+ 64
127
+ ],
128
+ "slot_index": 0
129
+ }
130
+ ],
131
+ "properties": {
132
+ "Node name for S&R": "EmptyLatentImage"
133
+ },
134
+ "widgets_values": [
135
+ 512,
136
+ 512,
137
+ 1
138
+ ]
139
+ },
140
+ {
141
+ "id": 12,
142
+ "type": "LoadImage",
143
+ "pos": [
144
+ 311,
145
+ 270
146
+ ],
147
+ "size": {
148
+ "0": 315,
149
+ "1": 314
150
+ },
151
+ "flags": {},
152
+ "order": 2,
153
+ "mode": 0,
154
+ "outputs": [
155
+ {
156
+ "name": "IMAGE",
157
+ "type": "IMAGE",
158
+ "links": [
159
+ 27,
160
+ 37,
161
+ 48,
162
+ 59,
163
+ 70
164
+ ],
165
+ "shape": 3,
166
+ "slot_index": 0
167
+ },
168
+ {
169
+ "name": "MASK",
170
+ "type": "MASK",
171
+ "links": null,
172
+ "shape": 3
173
+ }
174
+ ],
175
+ "properties": {
176
+ "Node name for S&R": "LoadImage"
177
+ },
178
+ "widgets_values": [
179
+ "warrior_woman.png",
180
+ "image"
181
+ ]
182
+ },
183
+ {
184
+ "id": 3,
185
+ "type": "KSampler",
186
+ "pos": [
187
+ 1660,
188
+ 290
189
+ ],
190
+ "size": {
191
+ "0": 315,
192
+ "1": 262
193
+ },
194
+ "flags": {},
195
+ "order": 12,
196
+ "mode": 0,
197
+ "inputs": [
198
+ {
199
+ "name": "model",
200
+ "type": "MODEL",
201
+ "link": 23
202
+ },
203
+ {
204
+ "name": "positive",
205
+ "type": "CONDITIONING",
206
+ "link": 4
207
+ },
208
+ {
209
+ "name": "negative",
210
+ "type": "CONDITIONING",
211
+ "link": 6
212
+ },
213
+ {
214
+ "name": "latent_image",
215
+ "type": "LATENT",
216
+ "link": 2
217
+ }
218
+ ],
219
+ "outputs": [
220
+ {
221
+ "name": "LATENT",
222
+ "type": "LATENT",
223
+ "links": [
224
+ 7
225
+ ],
226
+ "slot_index": 0
227
+ }
228
+ ],
229
+ "properties": {
230
+ "Node name for S&R": "KSampler"
231
+ },
232
+ "widgets_values": [
233
+ 0,
234
+ "fixed",
235
+ 30,
236
+ 6.5,
237
+ "dpmpp_2m",
238
+ "karras",
239
+ 1
240
+ ]
241
+ },
242
+ {
243
+ "id": 20,
244
+ "type": "SaveImage",
245
+ "pos": [
246
+ 2030,
247
+ 940
248
+ ],
249
+ "size": {
250
+ "0": 529.7760009765625,
251
+ "1": 582.3048095703125
252
+ },
253
+ "flags": {},
254
+ "order": 23,
255
+ "mode": 0,
256
+ "inputs": [
257
+ {
258
+ "name": "images",
259
+ "type": "IMAGE",
260
+ "link": 34
261
+ }
262
+ ],
263
+ "properties": {},
264
+ "widgets_values": [
265
+ "IPAdapter"
266
+ ]
267
+ },
268
+ {
269
+ "id": 18,
270
+ "type": "KSampler",
271
+ "pos": [
272
+ 1660,
273
+ 940
274
+ ],
275
+ "size": {
276
+ "0": 315,
277
+ "1": 262
278
+ },
279
+ "flags": {},
280
+ "order": 13,
281
+ "mode": 0,
282
+ "inputs": [
283
+ {
284
+ "name": "model",
285
+ "type": "MODEL",
286
+ "link": 28
287
+ },
288
+ {
289
+ "name": "positive",
290
+ "type": "CONDITIONING",
291
+ "link": 29
292
+ },
293
+ {
294
+ "name": "negative",
295
+ "type": "CONDITIONING",
296
+ "link": 30
297
+ },
298
+ {
299
+ "name": "latent_image",
300
+ "type": "LATENT",
301
+ "link": 31
302
+ }
303
+ ],
304
+ "outputs": [
305
+ {
306
+ "name": "LATENT",
307
+ "type": "LATENT",
308
+ "links": [
309
+ 32
310
+ ],
311
+ "slot_index": 0
312
+ }
313
+ ],
314
+ "properties": {
315
+ "Node name for S&R": "KSampler"
316
+ },
317
+ "widgets_values": [
318
+ 0,
319
+ "fixed",
320
+ 30,
321
+ 6.5,
322
+ "dpmpp_2m",
323
+ "karras",
324
+ 1
325
+ ]
326
+ },
327
+ {
328
+ "id": 19,
329
+ "type": "VAEDecode",
330
+ "pos": [
331
+ 1830,
332
+ 1280
333
+ ],
334
+ "size": {
335
+ "0": 140,
336
+ "1": 46
337
+ },
338
+ "flags": {},
339
+ "order": 18,
340
+ "mode": 0,
341
+ "inputs": [
342
+ {
343
+ "name": "samples",
344
+ "type": "LATENT",
345
+ "link": 32
346
+ },
347
+ {
348
+ "name": "vae",
349
+ "type": "VAE",
350
+ "link": 33
351
+ }
352
+ ],
353
+ "outputs": [
354
+ {
355
+ "name": "IMAGE",
356
+ "type": "IMAGE",
357
+ "links": [
358
+ 34
359
+ ],
360
+ "slot_index": 0
361
+ }
362
+ ],
363
+ "properties": {
364
+ "Node name for S&R": "VAEDecode"
365
+ }
366
+ },
367
+ {
368
+ "id": 8,
369
+ "type": "VAEDecode",
370
+ "pos": [
371
+ 1820,
372
+ 610
373
+ ],
374
+ "size": {
375
+ "0": 140,
376
+ "1": 46
377
+ },
378
+ "flags": {},
379
+ "order": 17,
380
+ "mode": 0,
381
+ "inputs": [
382
+ {
383
+ "name": "samples",
384
+ "type": "LATENT",
385
+ "link": 7
386
+ },
387
+ {
388
+ "name": "vae",
389
+ "type": "VAE",
390
+ "link": 8
391
+ }
392
+ ],
393
+ "outputs": [
394
+ {
395
+ "name": "IMAGE",
396
+ "type": "IMAGE",
397
+ "links": [
398
+ 9
399
+ ],
400
+ "slot_index": 0
401
+ }
402
+ ],
403
+ "properties": {
404
+ "Node name for S&R": "VAEDecode"
405
+ }
406
+ },
407
+ {
408
+ "id": 9,
409
+ "type": "SaveImage",
410
+ "pos": [
411
+ 2040,
412
+ 300
413
+ ],
414
+ "size": {
415
+ "0": 529.7760009765625,
416
+ "1": 582.3048095703125
417
+ },
418
+ "flags": {},
419
+ "order": 22,
420
+ "mode": 0,
421
+ "inputs": [
422
+ {
423
+ "name": "images",
424
+ "type": "IMAGE",
425
+ "link": 9
426
+ }
427
+ ],
428
+ "properties": {},
429
+ "widgets_values": [
430
+ "IPAdapter"
431
+ ]
432
+ },
433
+ {
434
+ "id": 14,
435
+ "type": "IPAdapterAdvanced",
436
+ "pos": [
437
+ 1290,
438
+ 250
439
+ ],
440
+ "size": {
441
+ "0": 315,
442
+ "1": 278
443
+ },
444
+ "flags": {},
445
+ "order": 7,
446
+ "mode": 0,
447
+ "inputs": [
448
+ {
449
+ "name": "model",
450
+ "type": "MODEL",
451
+ "link": 20
452
+ },
453
+ {
454
+ "name": "ipadapter",
455
+ "type": "IPADAPTER",
456
+ "link": 21,
457
+ "slot_index": 1
458
+ },
459
+ {
460
+ "name": "image",
461
+ "type": "IMAGE",
462
+ "link": 27
463
+ },
464
+ {
465
+ "name": "image_negative",
466
+ "type": "IMAGE",
467
+ "link": null
468
+ },
469
+ {
470
+ "name": "attn_mask",
471
+ "type": "MASK",
472
+ "link": null
473
+ },
474
+ {
475
+ "name": "clip_vision",
476
+ "type": "CLIP_VISION",
477
+ "link": 24,
478
+ "slot_index": 5
479
+ }
480
+ ],
481
+ "outputs": [
482
+ {
483
+ "name": "MODEL",
484
+ "type": "MODEL",
485
+ "links": [
486
+ 23
487
+ ],
488
+ "shape": 3,
489
+ "slot_index": 0
490
+ }
491
+ ],
492
+ "properties": {
493
+ "Node name for S&R": "IPAdapterAdvanced"
494
+ },
495
+ "widgets_values": [
496
+ 0.8,
497
+ "linear",
498
+ "concat",
499
+ 0,
500
+ 1,
501
+ "V only"
502
+ ]
503
+ },
504
+ {
505
+ "id": 21,
506
+ "type": "IPAdapterAdvanced",
507
+ "pos": [
508
+ 1280,
509
+ 900
510
+ ],
511
+ "size": {
512
+ "0": 315,
513
+ "1": 278
514
+ },
515
+ "flags": {},
516
+ "order": 8,
517
+ "mode": 0,
518
+ "inputs": [
519
+ {
520
+ "name": "model",
521
+ "type": "MODEL",
522
+ "link": 35
523
+ },
524
+ {
525
+ "name": "ipadapter",
526
+ "type": "IPADAPTER",
527
+ "link": 36,
528
+ "slot_index": 1
529
+ },
530
+ {
531
+ "name": "image",
532
+ "type": "IMAGE",
533
+ "link": 37
534
+ },
535
+ {
536
+ "name": "image_negative",
537
+ "type": "IMAGE",
538
+ "link": null
539
+ },
540
+ {
541
+ "name": "attn_mask",
542
+ "type": "MASK",
543
+ "link": null
544
+ },
545
+ {
546
+ "name": "clip_vision",
547
+ "type": "CLIP_VISION",
548
+ "link": 38,
549
+ "slot_index": 5
550
+ }
551
+ ],
552
+ "outputs": [
553
+ {
554
+ "name": "MODEL",
555
+ "type": "MODEL",
556
+ "links": [
557
+ 28
558
+ ],
559
+ "shape": 3,
560
+ "slot_index": 0
561
+ }
562
+ ],
563
+ "properties": {
564
+ "Node name for S&R": "IPAdapterAdvanced"
565
+ },
566
+ "widgets_values": [
567
+ 0.8,
568
+ "ease in",
569
+ "concat",
570
+ 0,
571
+ 1,
572
+ "V only"
573
+ ]
574
+ },
575
+ {
576
+ "id": 22,
577
+ "type": "KSampler",
578
+ "pos": [
579
+ 1660,
580
+ 1580
581
+ ],
582
+ "size": {
583
+ "0": 315,
584
+ "1": 262
585
+ },
586
+ "flags": {},
587
+ "order": 14,
588
+ "mode": 0,
589
+ "inputs": [
590
+ {
591
+ "name": "model",
592
+ "type": "MODEL",
593
+ "link": 39
594
+ },
595
+ {
596
+ "name": "positive",
597
+ "type": "CONDITIONING",
598
+ "link": 40
599
+ },
600
+ {
601
+ "name": "negative",
602
+ "type": "CONDITIONING",
603
+ "link": 41
604
+ },
605
+ {
606
+ "name": "latent_image",
607
+ "type": "LATENT",
608
+ "link": 42
609
+ }
610
+ ],
611
+ "outputs": [
612
+ {
613
+ "name": "LATENT",
614
+ "type": "LATENT",
615
+ "links": [
616
+ 43
617
+ ],
618
+ "slot_index": 0
619
+ }
620
+ ],
621
+ "properties": {
622
+ "Node name for S&R": "KSampler"
623
+ },
624
+ "widgets_values": [
625
+ 0,
626
+ "fixed",
627
+ 30,
628
+ 6.5,
629
+ "dpmpp_2m",
630
+ "karras",
631
+ 1
632
+ ]
633
+ },
634
+ {
635
+ "id": 23,
636
+ "type": "VAEDecode",
637
+ "pos": [
638
+ 1830,
639
+ 1920
640
+ ],
641
+ "size": {
642
+ "0": 140,
643
+ "1": 46
644
+ },
645
+ "flags": {},
646
+ "order": 19,
647
+ "mode": 0,
648
+ "inputs": [
649
+ {
650
+ "name": "samples",
651
+ "type": "LATENT",
652
+ "link": 43
653
+ },
654
+ {
655
+ "name": "vae",
656
+ "type": "VAE",
657
+ "link": 44
658
+ }
659
+ ],
660
+ "outputs": [
661
+ {
662
+ "name": "IMAGE",
663
+ "type": "IMAGE",
664
+ "links": [
665
+ 45
666
+ ],
667
+ "slot_index": 0
668
+ }
669
+ ],
670
+ "properties": {
671
+ "Node name for S&R": "VAEDecode"
672
+ }
673
+ },
674
+ {
675
+ "id": 25,
676
+ "type": "IPAdapterAdvanced",
677
+ "pos": [
678
+ 1280,
679
+ 1540
680
+ ],
681
+ "size": {
682
+ "0": 315,
683
+ "1": 278
684
+ },
685
+ "flags": {},
686
+ "order": 9,
687
+ "mode": 0,
688
+ "inputs": [
689
+ {
690
+ "name": "model",
691
+ "type": "MODEL",
692
+ "link": 46
693
+ },
694
+ {
695
+ "name": "ipadapter",
696
+ "type": "IPADAPTER",
697
+ "link": 47,
698
+ "slot_index": 1
699
+ },
700
+ {
701
+ "name": "image",
702
+ "type": "IMAGE",
703
+ "link": 48
704
+ },
705
+ {
706
+ "name": "image_negative",
707
+ "type": "IMAGE",
708
+ "link": null
709
+ },
710
+ {
711
+ "name": "attn_mask",
712
+ "type": "MASK",
713
+ "link": null
714
+ },
715
+ {
716
+ "name": "clip_vision",
717
+ "type": "CLIP_VISION",
718
+ "link": 49,
719
+ "slot_index": 5
720
+ }
721
+ ],
722
+ "outputs": [
723
+ {
724
+ "name": "MODEL",
725
+ "type": "MODEL",
726
+ "links": [
727
+ 39
728
+ ],
729
+ "shape": 3,
730
+ "slot_index": 0
731
+ }
732
+ ],
733
+ "properties": {
734
+ "Node name for S&R": "IPAdapterAdvanced"
735
+ },
736
+ "widgets_values": [
737
+ 0.8,
738
+ "ease out",
739
+ "concat",
740
+ 0,
741
+ 1,
742
+ "V only"
743
+ ]
744
+ },
745
+ {
746
+ "id": 24,
747
+ "type": "SaveImage",
748
+ "pos": [
749
+ 2030,
750
+ 1580
751
+ ],
752
+ "size": {
753
+ "0": 529.7760009765625,
754
+ "1": 582.3048095703125
755
+ },
756
+ "flags": {},
757
+ "order": 24,
758
+ "mode": 0,
759
+ "inputs": [
760
+ {
761
+ "name": "images",
762
+ "type": "IMAGE",
763
+ "link": 45
764
+ }
765
+ ],
766
+ "properties": {},
767
+ "widgets_values": [
768
+ "IPAdapter"
769
+ ]
770
+ },
771
+ {
772
+ "id": 27,
773
+ "type": "VAEDecode",
774
+ "pos": [
775
+ 3750,
776
+ 670
777
+ ],
778
+ "size": {
779
+ "0": 140,
780
+ "1": 46
781
+ },
782
+ "flags": {},
783
+ "order": 20,
784
+ "mode": 0,
785
+ "inputs": [
786
+ {
787
+ "name": "samples",
788
+ "type": "LATENT",
789
+ "link": 54
790
+ },
791
+ {
792
+ "name": "vae",
793
+ "type": "VAE",
794
+ "link": 55
795
+ }
796
+ ],
797
+ "outputs": [
798
+ {
799
+ "name": "IMAGE",
800
+ "type": "IMAGE",
801
+ "links": [
802
+ 56
803
+ ],
804
+ "slot_index": 0
805
+ }
806
+ ],
807
+ "properties": {
808
+ "Node name for S&R": "VAEDecode"
809
+ }
810
+ },
811
+ {
812
+ "id": 28,
813
+ "type": "SaveImage",
814
+ "pos": [
815
+ 2620,
816
+ 300
817
+ ],
818
+ "size": {
819
+ "0": 529.7760009765625,
820
+ "1": 582.3048095703125
821
+ },
822
+ "flags": {},
823
+ "order": 25,
824
+ "mode": 0,
825
+ "inputs": [
826
+ {
827
+ "name": "images",
828
+ "type": "IMAGE",
829
+ "link": 56
830
+ }
831
+ ],
832
+ "properties": {},
833
+ "widgets_values": [
834
+ "IPAdapter"
835
+ ]
836
+ },
837
+ {
838
+ "id": 30,
839
+ "type": "KSampler",
840
+ "pos": [
841
+ 3590,
842
+ 1000
843
+ ],
844
+ "size": {
845
+ "0": 315,
846
+ "1": 262
847
+ },
848
+ "flags": {},
849
+ "order": 16,
850
+ "mode": 0,
851
+ "inputs": [
852
+ {
853
+ "name": "model",
854
+ "type": "MODEL",
855
+ "link": 61
856
+ },
857
+ {
858
+ "name": "positive",
859
+ "type": "CONDITIONING",
860
+ "link": 62
861
+ },
862
+ {
863
+ "name": "negative",
864
+ "type": "CONDITIONING",
865
+ "link": 63
866
+ },
867
+ {
868
+ "name": "latent_image",
869
+ "type": "LATENT",
870
+ "link": 64
871
+ }
872
+ ],
873
+ "outputs": [
874
+ {
875
+ "name": "LATENT",
876
+ "type": "LATENT",
877
+ "links": [
878
+ 65
879
+ ],
880
+ "slot_index": 0
881
+ }
882
+ ],
883
+ "properties": {
884
+ "Node name for S&R": "KSampler"
885
+ },
886
+ "widgets_values": [
887
+ 0,
888
+ "fixed",
889
+ 30,
890
+ 6.5,
891
+ "dpmpp_2m",
892
+ "karras",
893
+ 1
894
+ ]
895
+ },
896
+ {
897
+ "id": 31,
898
+ "type": "VAEDecode",
899
+ "pos": [
900
+ 3760,
901
+ 1340
902
+ ],
903
+ "size": {
904
+ "0": 140,
905
+ "1": 46
906
+ },
907
+ "flags": {},
908
+ "order": 21,
909
+ "mode": 0,
910
+ "inputs": [
911
+ {
912
+ "name": "samples",
913
+ "type": "LATENT",
914
+ "link": 65
915
+ },
916
+ {
917
+ "name": "vae",
918
+ "type": "VAE",
919
+ "link": 66
920
+ }
921
+ ],
922
+ "outputs": [
923
+ {
924
+ "name": "IMAGE",
925
+ "type": "IMAGE",
926
+ "links": [
927
+ 67
928
+ ],
929
+ "slot_index": 0
930
+ }
931
+ ],
932
+ "properties": {
933
+ "Node name for S&R": "VAEDecode"
934
+ }
935
+ },
936
+ {
937
+ "id": 32,
938
+ "type": "SaveImage",
939
+ "pos": [
940
+ 2610,
941
+ 940
942
+ ],
943
+ "size": {
944
+ "0": 529.7760009765625,
945
+ "1": 582.3048095703125
946
+ },
947
+ "flags": {},
948
+ "order": 26,
949
+ "mode": 0,
950
+ "inputs": [
951
+ {
952
+ "name": "images",
953
+ "type": "IMAGE",
954
+ "link": 67
955
+ }
956
+ ],
957
+ "properties": {},
958
+ "widgets_values": [
959
+ "IPAdapter"
960
+ ]
961
+ },
962
+ {
963
+ "id": 26,
964
+ "type": "KSampler",
965
+ "pos": [
966
+ 3590,
967
+ 350
968
+ ],
969
+ "size": {
970
+ "0": 315,
971
+ "1": 262
972
+ },
973
+ "flags": {},
974
+ "order": 15,
975
+ "mode": 0,
976
+ "inputs": [
977
+ {
978
+ "name": "model",
979
+ "type": "MODEL",
980
+ "link": 50
981
+ },
982
+ {
983
+ "name": "positive",
984
+ "type": "CONDITIONING",
985
+ "link": 51
986
+ },
987
+ {
988
+ "name": "negative",
989
+ "type": "CONDITIONING",
990
+ "link": 52
991
+ },
992
+ {
993
+ "name": "latent_image",
994
+ "type": "LATENT",
995
+ "link": 53
996
+ }
997
+ ],
998
+ "outputs": [
999
+ {
1000
+ "name": "LATENT",
1001
+ "type": "LATENT",
1002
+ "links": [
1003
+ 54
1004
+ ],
1005
+ "slot_index": 0
1006
+ }
1007
+ ],
1008
+ "properties": {
1009
+ "Node name for S&R": "KSampler"
1010
+ },
1011
+ "widgets_values": [
1012
+ 0,
1013
+ "fixed",
1014
+ 30,
1015
+ 6.5,
1016
+ "dpmpp_2m",
1017
+ "karras",
1018
+ 1
1019
+ ]
1020
+ },
1021
+ {
1022
+ "id": 29,
1023
+ "type": "IPAdapterAdvanced",
1024
+ "pos": [
1025
+ 3220,
1026
+ 310
1027
+ ],
1028
+ "size": {
1029
+ "0": 315,
1030
+ "1": 278
1031
+ },
1032
+ "flags": {},
1033
+ "order": 10,
1034
+ "mode": 0,
1035
+ "inputs": [
1036
+ {
1037
+ "name": "model",
1038
+ "type": "MODEL",
1039
+ "link": 57
1040
+ },
1041
+ {
1042
+ "name": "ipadapter",
1043
+ "type": "IPADAPTER",
1044
+ "link": 58,
1045
+ "slot_index": 1
1046
+ },
1047
+ {
1048
+ "name": "image",
1049
+ "type": "IMAGE",
1050
+ "link": 59
1051
+ },
1052
+ {
1053
+ "name": "image_negative",
1054
+ "type": "IMAGE",
1055
+ "link": null
1056
+ },
1057
+ {
1058
+ "name": "attn_mask",
1059
+ "type": "MASK",
1060
+ "link": null
1061
+ },
1062
+ {
1063
+ "name": "clip_vision",
1064
+ "type": "CLIP_VISION",
1065
+ "link": 60,
1066
+ "slot_index": 5
1067
+ }
1068
+ ],
1069
+ "outputs": [
1070
+ {
1071
+ "name": "MODEL",
1072
+ "type": "MODEL",
1073
+ "links": [
1074
+ 50
1075
+ ],
1076
+ "shape": 3,
1077
+ "slot_index": 0
1078
+ }
1079
+ ],
1080
+ "properties": {
1081
+ "Node name for S&R": "IPAdapterAdvanced"
1082
+ },
1083
+ "widgets_values": [
1084
+ 0.8,
1085
+ "ease in-out",
1086
+ "concat",
1087
+ 0,
1088
+ 1,
1089
+ "V only"
1090
+ ]
1091
+ },
1092
+ {
1093
+ "id": 33,
1094
+ "type": "IPAdapterAdvanced",
1095
+ "pos": [
1096
+ 3210,
1097
+ 960
1098
+ ],
1099
+ "size": {
1100
+ "0": 315,
1101
+ "1": 278
1102
+ },
1103
+ "flags": {},
1104
+ "order": 11,
1105
+ "mode": 0,
1106
+ "inputs": [
1107
+ {
1108
+ "name": "model",
1109
+ "type": "MODEL",
1110
+ "link": 68
1111
+ },
1112
+ {
1113
+ "name": "ipadapter",
1114
+ "type": "IPADAPTER",
1115
+ "link": 69,
1116
+ "slot_index": 1
1117
+ },
1118
+ {
1119
+ "name": "image",
1120
+ "type": "IMAGE",
1121
+ "link": 70
1122
+ },
1123
+ {
1124
+ "name": "image_negative",
1125
+ "type": "IMAGE",
1126
+ "link": null
1127
+ },
1128
+ {
1129
+ "name": "attn_mask",
1130
+ "type": "MASK",
1131
+ "link": null
1132
+ },
1133
+ {
1134
+ "name": "clip_vision",
1135
+ "type": "CLIP_VISION",
1136
+ "link": 71,
1137
+ "slot_index": 5
1138
+ }
1139
+ ],
1140
+ "outputs": [
1141
+ {
1142
+ "name": "MODEL",
1143
+ "type": "MODEL",
1144
+ "links": [
1145
+ 61
1146
+ ],
1147
+ "shape": 3,
1148
+ "slot_index": 0
1149
+ }
1150
+ ],
1151
+ "properties": {
1152
+ "Node name for S&R": "IPAdapterAdvanced"
1153
+ },
1154
+ "widgets_values": [
1155
+ 0.8,
1156
+ "reverse in-out",
1157
+ "concat",
1158
+ 0,
1159
+ 1,
1160
+ "V only"
1161
+ ]
1162
+ },
1163
+ {
1164
+ "id": 6,
1165
+ "type": "CLIPTextEncode",
1166
+ "pos": [
1167
+ 690,
1168
+ 610
1169
+ ],
1170
+ "size": {
1171
+ "0": 422.84503173828125,
1172
+ "1": 164.31304931640625
1173
+ },
1174
+ "flags": {},
1175
+ "order": 5,
1176
+ "mode": 0,
1177
+ "inputs": [
1178
+ {
1179
+ "name": "clip",
1180
+ "type": "CLIP",
1181
+ "link": 3
1182
+ }
1183
+ ],
1184
+ "outputs": [
1185
+ {
1186
+ "name": "CONDITIONING",
1187
+ "type": "CONDITIONING",
1188
+ "links": [
1189
+ 4,
1190
+ 29,
1191
+ 40,
1192
+ 51,
1193
+ 62
1194
+ ],
1195
+ "slot_index": 0
1196
+ }
1197
+ ],
1198
+ "properties": {
1199
+ "Node name for S&R": "CLIPTextEncode"
1200
+ },
1201
+ "widgets_values": [
1202
+ "closeup of a fierce warrior woman wearing a full armor at the end of a battle. cherry blossoms\n\nhigh quality, detailed"
1203
+ ]
1204
+ },
1205
+ {
1206
+ "id": 15,
1207
+ "type": "IPAdapterModelLoader",
1208
+ "pos": [
1209
+ 308,
1210
+ 52
1211
+ ],
1212
+ "size": {
1213
+ "0": 315,
1214
+ "1": 58
1215
+ },
1216
+ "flags": {},
1217
+ "order": 3,
1218
+ "mode": 0,
1219
+ "outputs": [
1220
+ {
1221
+ "name": "IPADAPTER",
1222
+ "type": "IPADAPTER",
1223
+ "links": [
1224
+ 21,
1225
+ 36,
1226
+ 47,
1227
+ 58,
1228
+ 69
1229
+ ],
1230
+ "shape": 3
1231
+ }
1232
+ ],
1233
+ "properties": {
1234
+ "Node name for S&R": "IPAdapterModelLoader"
1235
+ },
1236
+ "widgets_values": [
1237
+ "ip-adapter-plus_sd15.safetensors"
1238
+ ]
1239
+ },
1240
+ {
1241
+ "id": 16,
1242
+ "type": "CLIPVisionLoader",
1243
+ "pos": [
1244
+ 308,
1245
+ 161
1246
+ ],
1247
+ "size": {
1248
+ "0": 315,
1249
+ "1": 58
1250
+ },
1251
+ "flags": {},
1252
+ "order": 4,
1253
+ "mode": 0,
1254
+ "outputs": [
1255
+ {
1256
+ "name": "CLIP_VISION",
1257
+ "type": "CLIP_VISION",
1258
+ "links": [
1259
+ 24,
1260
+ 38,
1261
+ 49,
1262
+ 60,
1263
+ 71
1264
+ ],
1265
+ "shape": 3
1266
+ }
1267
+ ],
1268
+ "properties": {
1269
+ "Node name for S&R": "CLIPVisionLoader"
1270
+ },
1271
+ "widgets_values": [
1272
+ "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors"
1273
+ ]
1274
+ }
1275
+ ],
1276
+ "links": [
1277
+ [
1278
+ 2,
1279
+ 5,
1280
+ 0,
1281
+ 3,
1282
+ 3,
1283
+ "LATENT"
1284
+ ],
1285
+ [
1286
+ 3,
1287
+ 4,
1288
+ 1,
1289
+ 6,
1290
+ 0,
1291
+ "CLIP"
1292
+ ],
1293
+ [
1294
+ 4,
1295
+ 6,
1296
+ 0,
1297
+ 3,
1298
+ 1,
1299
+ "CONDITIONING"
1300
+ ],
1301
+ [
1302
+ 5,
1303
+ 4,
1304
+ 1,
1305
+ 7,
1306
+ 0,
1307
+ "CLIP"
1308
+ ],
1309
+ [
1310
+ 6,
1311
+ 7,
1312
+ 0,
1313
+ 3,
1314
+ 2,
1315
+ "CONDITIONING"
1316
+ ],
1317
+ [
1318
+ 7,
1319
+ 3,
1320
+ 0,
1321
+ 8,
1322
+ 0,
1323
+ "LATENT"
1324
+ ],
1325
+ [
1326
+ 8,
1327
+ 4,
1328
+ 2,
1329
+ 8,
1330
+ 1,
1331
+ "VAE"
1332
+ ],
1333
+ [
1334
+ 9,
1335
+ 8,
1336
+ 0,
1337
+ 9,
1338
+ 0,
1339
+ "IMAGE"
1340
+ ],
1341
+ [
1342
+ 20,
1343
+ 4,
1344
+ 0,
1345
+ 14,
1346
+ 0,
1347
+ "MODEL"
1348
+ ],
1349
+ [
1350
+ 21,
1351
+ 15,
1352
+ 0,
1353
+ 14,
1354
+ 1,
1355
+ "IPADAPTER"
1356
+ ],
1357
+ [
1358
+ 23,
1359
+ 14,
1360
+ 0,
1361
+ 3,
1362
+ 0,
1363
+ "MODEL"
1364
+ ],
1365
+ [
1366
+ 24,
1367
+ 16,
1368
+ 0,
1369
+ 14,
1370
+ 5,
1371
+ "CLIP_VISION"
1372
+ ],
1373
+ [
1374
+ 27,
1375
+ 12,
1376
+ 0,
1377
+ 14,
1378
+ 2,
1379
+ "IMAGE"
1380
+ ],
1381
+ [
1382
+ 28,
1383
+ 21,
1384
+ 0,
1385
+ 18,
1386
+ 0,
1387
+ "MODEL"
1388
+ ],
1389
+ [
1390
+ 29,
1391
+ 6,
1392
+ 0,
1393
+ 18,
1394
+ 1,
1395
+ "CONDITIONING"
1396
+ ],
1397
+ [
1398
+ 30,
1399
+ 7,
1400
+ 0,
1401
+ 18,
1402
+ 2,
1403
+ "CONDITIONING"
1404
+ ],
1405
+ [
1406
+ 31,
1407
+ 5,
1408
+ 0,
1409
+ 18,
1410
+ 3,
1411
+ "LATENT"
1412
+ ],
1413
+ [
1414
+ 32,
1415
+ 18,
1416
+ 0,
1417
+ 19,
1418
+ 0,
1419
+ "LATENT"
1420
+ ],
1421
+ [
1422
+ 33,
1423
+ 4,
1424
+ 2,
1425
+ 19,
1426
+ 1,
1427
+ "VAE"
1428
+ ],
1429
+ [
1430
+ 34,
1431
+ 19,
1432
+ 0,
1433
+ 20,
1434
+ 0,
1435
+ "IMAGE"
1436
+ ],
1437
+ [
1438
+ 35,
1439
+ 4,
1440
+ 0,
1441
+ 21,
1442
+ 0,
1443
+ "MODEL"
1444
+ ],
1445
+ [
1446
+ 36,
1447
+ 15,
1448
+ 0,
1449
+ 21,
1450
+ 1,
1451
+ "IPADAPTER"
1452
+ ],
1453
+ [
1454
+ 37,
1455
+ 12,
1456
+ 0,
1457
+ 21,
1458
+ 2,
1459
+ "IMAGE"
1460
+ ],
1461
+ [
1462
+ 38,
1463
+ 16,
1464
+ 0,
1465
+ 21,
1466
+ 5,
1467
+ "CLIP_VISION"
1468
+ ],
1469
+ [
1470
+ 39,
1471
+ 25,
1472
+ 0,
1473
+ 22,
1474
+ 0,
1475
+ "MODEL"
1476
+ ],
1477
+ [
1478
+ 40,
1479
+ 6,
1480
+ 0,
1481
+ 22,
1482
+ 1,
1483
+ "CONDITIONING"
1484
+ ],
1485
+ [
1486
+ 41,
1487
+ 7,
1488
+ 0,
1489
+ 22,
1490
+ 2,
1491
+ "CONDITIONING"
1492
+ ],
1493
+ [
1494
+ 42,
1495
+ 5,
1496
+ 0,
1497
+ 22,
1498
+ 3,
1499
+ "LATENT"
1500
+ ],
1501
+ [
1502
+ 43,
1503
+ 22,
1504
+ 0,
1505
+ 23,
1506
+ 0,
1507
+ "LATENT"
1508
+ ],
1509
+ [
1510
+ 44,
1511
+ 4,
1512
+ 2,
1513
+ 23,
1514
+ 1,
1515
+ "VAE"
1516
+ ],
1517
+ [
1518
+ 45,
1519
+ 23,
1520
+ 0,
1521
+ 24,
1522
+ 0,
1523
+ "IMAGE"
1524
+ ],
1525
+ [
1526
+ 46,
1527
+ 4,
1528
+ 0,
1529
+ 25,
1530
+ 0,
1531
+ "MODEL"
1532
+ ],
1533
+ [
1534
+ 47,
1535
+ 15,
1536
+ 0,
1537
+ 25,
1538
+ 1,
1539
+ "IPADAPTER"
1540
+ ],
1541
+ [
1542
+ 48,
1543
+ 12,
1544
+ 0,
1545
+ 25,
1546
+ 2,
1547
+ "IMAGE"
1548
+ ],
1549
+ [
1550
+ 49,
1551
+ 16,
1552
+ 0,
1553
+ 25,
1554
+ 5,
1555
+ "CLIP_VISION"
1556
+ ],
1557
+ [
1558
+ 50,
1559
+ 29,
1560
+ 0,
1561
+ 26,
1562
+ 0,
1563
+ "MODEL"
1564
+ ],
1565
+ [
1566
+ 51,
1567
+ 6,
1568
+ 0,
1569
+ 26,
1570
+ 1,
1571
+ "CONDITIONING"
1572
+ ],
1573
+ [
1574
+ 52,
1575
+ 7,
1576
+ 0,
1577
+ 26,
1578
+ 2,
1579
+ "CONDITIONING"
1580
+ ],
1581
+ [
1582
+ 53,
1583
+ 5,
1584
+ 0,
1585
+ 26,
1586
+ 3,
1587
+ "LATENT"
1588
+ ],
1589
+ [
1590
+ 54,
1591
+ 26,
1592
+ 0,
1593
+ 27,
1594
+ 0,
1595
+ "LATENT"
1596
+ ],
1597
+ [
1598
+ 55,
1599
+ 4,
1600
+ 2,
1601
+ 27,
1602
+ 1,
1603
+ "VAE"
1604
+ ],
1605
+ [
1606
+ 56,
1607
+ 27,
1608
+ 0,
1609
+ 28,
1610
+ 0,
1611
+ "IMAGE"
1612
+ ],
1613
+ [
1614
+ 57,
1615
+ 4,
1616
+ 0,
1617
+ 29,
1618
+ 0,
1619
+ "MODEL"
1620
+ ],
1621
+ [
1622
+ 58,
1623
+ 15,
1624
+ 0,
1625
+ 29,
1626
+ 1,
1627
+ "IPADAPTER"
1628
+ ],
1629
+ [
1630
+ 59,
1631
+ 12,
1632
+ 0,
1633
+ 29,
1634
+ 2,
1635
+ "IMAGE"
1636
+ ],
1637
+ [
1638
+ 60,
1639
+ 16,
1640
+ 0,
1641
+ 29,
1642
+ 5,
1643
+ "CLIP_VISION"
1644
+ ],
1645
+ [
1646
+ 61,
1647
+ 33,
1648
+ 0,
1649
+ 30,
1650
+ 0,
1651
+ "MODEL"
1652
+ ],
1653
+ [
1654
+ 62,
1655
+ 6,
1656
+ 0,
1657
+ 30,
1658
+ 1,
1659
+ "CONDITIONING"
1660
+ ],
1661
+ [
1662
+ 63,
1663
+ 7,
1664
+ 0,
1665
+ 30,
1666
+ 2,
1667
+ "CONDITIONING"
1668
+ ],
1669
+ [
1670
+ 64,
1671
+ 5,
1672
+ 0,
1673
+ 30,
1674
+ 3,
1675
+ "LATENT"
1676
+ ],
1677
+ [
1678
+ 65,
1679
+ 30,
1680
+ 0,
1681
+ 31,
1682
+ 0,
1683
+ "LATENT"
1684
+ ],
1685
+ [
1686
+ 66,
1687
+ 4,
1688
+ 2,
1689
+ 31,
1690
+ 1,
1691
+ "VAE"
1692
+ ],
1693
+ [
1694
+ 67,
1695
+ 31,
1696
+ 0,
1697
+ 32,
1698
+ 0,
1699
+ "IMAGE"
1700
+ ],
1701
+ [
1702
+ 68,
1703
+ 4,
1704
+ 0,
1705
+ 33,
1706
+ 0,
1707
+ "MODEL"
1708
+ ],
1709
+ [
1710
+ 69,
1711
+ 15,
1712
+ 0,
1713
+ 33,
1714
+ 1,
1715
+ "IPADAPTER"
1716
+ ],
1717
+ [
1718
+ 70,
1719
+ 12,
1720
+ 0,
1721
+ 33,
1722
+ 2,
1723
+ "IMAGE"
1724
+ ],
1725
+ [
1726
+ 71,
1727
+ 16,
1728
+ 0,
1729
+ 33,
1730
+ 5,
1731
+ "CLIP_VISION"
1732
+ ]
1733
+ ],
1734
+ "groups": [],
1735
+ "config": {},
1736
+ "extra": {},
1737
+ "version": 0.4
1738
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_weighted_embeds.json ADDED
@@ -0,0 +1,836 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 18,
3
+ "last_link_id": 29,
4
+ "nodes": [
5
+ {
6
+ "id": 4,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [
9
+ 50,
10
+ 730
11
+ ],
12
+ "size": {
13
+ "0": 315,
14
+ "1": 98
15
+ },
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "outputs": [
20
+ {
21
+ "name": "MODEL",
22
+ "type": "MODEL",
23
+ "links": [
24
+ 10
25
+ ],
26
+ "slot_index": 0
27
+ },
28
+ {
29
+ "name": "CLIP",
30
+ "type": "CLIP",
31
+ "links": [
32
+ 3,
33
+ 5
34
+ ],
35
+ "slot_index": 1
36
+ },
37
+ {
38
+ "name": "VAE",
39
+ "type": "VAE",
40
+ "links": [
41
+ 8
42
+ ],
43
+ "slot_index": 2
44
+ }
45
+ ],
46
+ "properties": {
47
+ "Node name for S&R": "CheckpointLoaderSimple"
48
+ },
49
+ "widgets_values": [
50
+ "sd15/realisticVisionV51_v51VAE.safetensors"
51
+ ]
52
+ },
53
+ {
54
+ "id": 6,
55
+ "type": "CLIPTextEncode",
56
+ "pos": [
57
+ 690,
58
+ 610
59
+ ],
60
+ "size": {
61
+ "0": 422.84503173828125,
62
+ "1": 164.31304931640625
63
+ },
64
+ "flags": {},
65
+ "order": 5,
66
+ "mode": 0,
67
+ "inputs": [
68
+ {
69
+ "name": "clip",
70
+ "type": "CLIP",
71
+ "link": 3
72
+ }
73
+ ],
74
+ "outputs": [
75
+ {
76
+ "name": "CONDITIONING",
77
+ "type": "CONDITIONING",
78
+ "links": [
79
+ 4
80
+ ],
81
+ "slot_index": 0
82
+ }
83
+ ],
84
+ "properties": {
85
+ "Node name for S&R": "CLIPTextEncode"
86
+ },
87
+ "widgets_values": [
88
+ "closeup of a fierce warrior woman wearing a full armor at the end of a battle\n\nhigh quality, detailed"
89
+ ]
90
+ },
91
+ {
92
+ "id": 9,
93
+ "type": "SaveImage",
94
+ "pos": [
95
+ 1770,
96
+ 710
97
+ ],
98
+ "size": {
99
+ "0": 529.7760009765625,
100
+ "1": 582.3048095703125
101
+ },
102
+ "flags": {},
103
+ "order": 13,
104
+ "mode": 0,
105
+ "inputs": [
106
+ {
107
+ "name": "images",
108
+ "type": "IMAGE",
109
+ "link": 9
110
+ }
111
+ ],
112
+ "properties": {},
113
+ "widgets_values": [
114
+ "IPAdapter"
115
+ ]
116
+ },
117
+ {
118
+ "id": 8,
119
+ "type": "VAEDecode",
120
+ "pos": [
121
+ 1570,
122
+ 700
123
+ ],
124
+ "size": {
125
+ "0": 140,
126
+ "1": 46
127
+ },
128
+ "flags": {},
129
+ "order": 12,
130
+ "mode": 0,
131
+ "inputs": [
132
+ {
133
+ "name": "samples",
134
+ "type": "LATENT",
135
+ "link": 7
136
+ },
137
+ {
138
+ "name": "vae",
139
+ "type": "VAE",
140
+ "link": 8
141
+ }
142
+ ],
143
+ "outputs": [
144
+ {
145
+ "name": "IMAGE",
146
+ "type": "IMAGE",
147
+ "links": [
148
+ 9
149
+ ],
150
+ "slot_index": 0
151
+ }
152
+ ],
153
+ "properties": {
154
+ "Node name for S&R": "VAEDecode"
155
+ }
156
+ },
157
+ {
158
+ "id": 5,
159
+ "type": "EmptyLatentImage",
160
+ "pos": [
161
+ 801,
162
+ 1097
163
+ ],
164
+ "size": {
165
+ "0": 315,
166
+ "1": 106
167
+ },
168
+ "flags": {},
169
+ "order": 1,
170
+ "mode": 0,
171
+ "outputs": [
172
+ {
173
+ "name": "LATENT",
174
+ "type": "LATENT",
175
+ "links": [
176
+ 2
177
+ ],
178
+ "slot_index": 0
179
+ }
180
+ ],
181
+ "properties": {
182
+ "Node name for S&R": "EmptyLatentImage"
183
+ },
184
+ "widgets_values": [
185
+ 512,
186
+ 512,
187
+ 1
188
+ ]
189
+ },
190
+ {
191
+ "id": 12,
192
+ "type": "LoadImage",
193
+ "pos": [
194
+ 453,
195
+ -296
196
+ ],
197
+ "size": {
198
+ "0": 315,
199
+ "1": 314
200
+ },
201
+ "flags": {},
202
+ "order": 2,
203
+ "mode": 0,
204
+ "outputs": [
205
+ {
206
+ "name": "IMAGE",
207
+ "type": "IMAGE",
208
+ "links": [
209
+ 21
210
+ ],
211
+ "shape": 3,
212
+ "slot_index": 0
213
+ },
214
+ {
215
+ "name": "MASK",
216
+ "type": "MASK",
217
+ "links": null,
218
+ "shape": 3
219
+ }
220
+ ],
221
+ "properties": {
222
+ "Node name for S&R": "LoadImage"
223
+ },
224
+ "widgets_values": [
225
+ "warrior_woman.png",
226
+ "image"
227
+ ]
228
+ },
229
+ {
230
+ "id": 15,
231
+ "type": "LoadImage",
232
+ "pos": [
233
+ 458,
234
+ 70
235
+ ],
236
+ "size": {
237
+ "0": 315,
238
+ "1": 314
239
+ },
240
+ "flags": {},
241
+ "order": 3,
242
+ "mode": 0,
243
+ "outputs": [
244
+ {
245
+ "name": "IMAGE",
246
+ "type": "IMAGE",
247
+ "links": [
248
+ 23
249
+ ],
250
+ "shape": 3,
251
+ "slot_index": 0
252
+ },
253
+ {
254
+ "name": "MASK",
255
+ "type": "MASK",
256
+ "links": null,
257
+ "shape": 3
258
+ }
259
+ ],
260
+ "properties": {
261
+ "Node name for S&R": "LoadImage"
262
+ },
263
+ "widgets_values": [
264
+ "anime_illustration.png",
265
+ "image"
266
+ ]
267
+ },
268
+ {
269
+ "id": 11,
270
+ "type": "IPAdapterUnifiedLoader",
271
+ "pos": [
272
+ 440,
273
+ 440
274
+ ],
275
+ "size": {
276
+ "0": 315,
277
+ "1": 78
278
+ },
279
+ "flags": {},
280
+ "order": 4,
281
+ "mode": 0,
282
+ "inputs": [
283
+ {
284
+ "name": "model",
285
+ "type": "MODEL",
286
+ "link": 10
287
+ },
288
+ {
289
+ "name": "ipadapter",
290
+ "type": "IPADAPTER",
291
+ "link": null
292
+ }
293
+ ],
294
+ "outputs": [
295
+ {
296
+ "name": "model",
297
+ "type": "MODEL",
298
+ "links": [
299
+ 19
300
+ ],
301
+ "shape": 3,
302
+ "slot_index": 0
303
+ },
304
+ {
305
+ "name": "ipadapter",
306
+ "type": "IPADAPTER",
307
+ "links": [
308
+ 20,
309
+ 22,
310
+ 27
311
+ ],
312
+ "shape": 3,
313
+ "slot_index": 1
314
+ }
315
+ ],
316
+ "properties": {
317
+ "Node name for S&R": "IPAdapterUnifiedLoader"
318
+ },
319
+ "widgets_values": [
320
+ "PLUS (high strength)"
321
+ ]
322
+ },
323
+ {
324
+ "id": 3,
325
+ "type": "KSampler",
326
+ "pos": [
327
+ 1210,
328
+ 700
329
+ ],
330
+ "size": {
331
+ "0": 315,
332
+ "1": 262
333
+ },
334
+ "flags": {},
335
+ "order": 11,
336
+ "mode": 0,
337
+ "inputs": [
338
+ {
339
+ "name": "model",
340
+ "type": "MODEL",
341
+ "link": 28
342
+ },
343
+ {
344
+ "name": "positive",
345
+ "type": "CONDITIONING",
346
+ "link": 4
347
+ },
348
+ {
349
+ "name": "negative",
350
+ "type": "CONDITIONING",
351
+ "link": 6
352
+ },
353
+ {
354
+ "name": "latent_image",
355
+ "type": "LATENT",
356
+ "link": 2
357
+ }
358
+ ],
359
+ "outputs": [
360
+ {
361
+ "name": "LATENT",
362
+ "type": "LATENT",
363
+ "links": [
364
+ 7
365
+ ],
366
+ "slot_index": 0
367
+ }
368
+ ],
369
+ "properties": {
370
+ "Node name for S&R": "KSampler"
371
+ },
372
+ "widgets_values": [
373
+ 0,
374
+ "fixed",
375
+ 30,
376
+ 6.5,
377
+ "dpmpp_2m",
378
+ "karras",
379
+ 1
380
+ ]
381
+ },
382
+ {
383
+ "id": 7,
384
+ "type": "CLIPTextEncode",
385
+ "pos": [
386
+ 690,
387
+ 840
388
+ ],
389
+ "size": {
390
+ "0": 425.27801513671875,
391
+ "1": 180.6060791015625
392
+ },
393
+ "flags": {},
394
+ "order": 6,
395
+ "mode": 0,
396
+ "inputs": [
397
+ {
398
+ "name": "clip",
399
+ "type": "CLIP",
400
+ "link": 5
401
+ }
402
+ ],
403
+ "outputs": [
404
+ {
405
+ "name": "CONDITIONING",
406
+ "type": "CONDITIONING",
407
+ "links": [
408
+ 6
409
+ ],
410
+ "slot_index": 0
411
+ }
412
+ ],
413
+ "properties": {
414
+ "Node name for S&R": "CLIPTextEncode"
415
+ },
416
+ "widgets_values": [
417
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed, hat, hood, scars, blood"
418
+ ]
419
+ },
420
+ {
421
+ "id": 17,
422
+ "type": "IPAdapterEncoder",
423
+ "pos": [
424
+ 859,
425
+ 69
426
+ ],
427
+ "size": [
428
+ 210,
429
+ 118
430
+ ],
431
+ "flags": {},
432
+ "order": 8,
433
+ "mode": 0,
434
+ "inputs": [
435
+ {
436
+ "name": "ipadapter",
437
+ "type": "IPADAPTER",
438
+ "link": 22
439
+ },
440
+ {
441
+ "name": "image",
442
+ "type": "IMAGE",
443
+ "link": 23
444
+ },
445
+ {
446
+ "name": "mask",
447
+ "type": "MASK",
448
+ "link": null
449
+ },
450
+ {
451
+ "name": "clip_vision",
452
+ "type": "CLIP_VISION",
453
+ "link": null
454
+ }
455
+ ],
456
+ "outputs": [
457
+ {
458
+ "name": "pos_embed",
459
+ "type": "EMBEDS",
460
+ "links": [
461
+ 25
462
+ ],
463
+ "shape": 3,
464
+ "slot_index": 0
465
+ },
466
+ {
467
+ "name": "neg_embed",
468
+ "type": "EMBEDS",
469
+ "links": null,
470
+ "shape": 3
471
+ }
472
+ ],
473
+ "properties": {
474
+ "Node name for S&R": "IPAdapterEncoder"
475
+ },
476
+ "widgets_values": [
477
+ 1.5
478
+ ]
479
+ },
480
+ {
481
+ "id": 18,
482
+ "type": "IPAdapterCombineEmbeds",
483
+ "pos": [
484
+ 1136,
485
+ -95
486
+ ],
487
+ "size": [
488
+ 210,
489
+ 138
490
+ ],
491
+ "flags": {},
492
+ "order": 9,
493
+ "mode": 0,
494
+ "inputs": [
495
+ {
496
+ "name": "embed1",
497
+ "type": "EMBEDS",
498
+ "link": 24
499
+ },
500
+ {
501
+ "name": "embed2",
502
+ "type": "EMBEDS",
503
+ "link": 25
504
+ },
505
+ {
506
+ "name": "embed3",
507
+ "type": "EMBEDS",
508
+ "link": null
509
+ },
510
+ {
511
+ "name": "embed4",
512
+ "type": "EMBEDS",
513
+ "link": null
514
+ },
515
+ {
516
+ "name": "embed5",
517
+ "type": "EMBEDS",
518
+ "link": null
519
+ }
520
+ ],
521
+ "outputs": [
522
+ {
523
+ "name": "EMBEDS",
524
+ "type": "EMBEDS",
525
+ "links": [
526
+ 26
527
+ ],
528
+ "shape": 3,
529
+ "slot_index": 0
530
+ }
531
+ ],
532
+ "properties": {
533
+ "Node name for S&R": "IPAdapterCombineEmbeds"
534
+ },
535
+ "widgets_values": [
536
+ "average"
537
+ ]
538
+ },
539
+ {
540
+ "id": 14,
541
+ "type": "IPAdapterEmbeds",
542
+ "pos": [
543
+ 1143,
544
+ 160
545
+ ],
546
+ "size": {
547
+ "0": 315,
548
+ "1": 230
549
+ },
550
+ "flags": {},
551
+ "order": 10,
552
+ "mode": 0,
553
+ "inputs": [
554
+ {
555
+ "name": "model",
556
+ "type": "MODEL",
557
+ "link": 19
558
+ },
559
+ {
560
+ "name": "ipadapter",
561
+ "type": "IPADAPTER",
562
+ "link": 27
563
+ },
564
+ {
565
+ "name": "pos_embed",
566
+ "type": "EMBEDS",
567
+ "link": 26
568
+ },
569
+ {
570
+ "name": "neg_embed",
571
+ "type": "EMBEDS",
572
+ "link": 29
573
+ },
574
+ {
575
+ "name": "attn_mask",
576
+ "type": "MASK",
577
+ "link": null
578
+ },
579
+ {
580
+ "name": "clip_vision",
581
+ "type": "CLIP_VISION",
582
+ "link": null
583
+ }
584
+ ],
585
+ "outputs": [
586
+ {
587
+ "name": "MODEL",
588
+ "type": "MODEL",
589
+ "links": [
590
+ 28
591
+ ],
592
+ "shape": 3,
593
+ "slot_index": 0
594
+ }
595
+ ],
596
+ "properties": {
597
+ "Node name for S&R": "IPAdapterEmbeds"
598
+ },
599
+ "widgets_values": [
600
+ 0.8,
601
+ "linear",
602
+ 0,
603
+ 1
604
+ ]
605
+ },
606
+ {
607
+ "id": 16,
608
+ "type": "IPAdapterEncoder",
609
+ "pos": [
610
+ 863,
611
+ -285
612
+ ],
613
+ "size": [
614
+ 210,
615
+ 118
616
+ ],
617
+ "flags": {},
618
+ "order": 7,
619
+ "mode": 0,
620
+ "inputs": [
621
+ {
622
+ "name": "ipadapter",
623
+ "type": "IPADAPTER",
624
+ "link": 20
625
+ },
626
+ {
627
+ "name": "image",
628
+ "type": "IMAGE",
629
+ "link": 21
630
+ },
631
+ {
632
+ "name": "mask",
633
+ "type": "MASK",
634
+ "link": null
635
+ },
636
+ {
637
+ "name": "clip_vision",
638
+ "type": "CLIP_VISION",
639
+ "link": null
640
+ }
641
+ ],
642
+ "outputs": [
643
+ {
644
+ "name": "pos_embed",
645
+ "type": "EMBEDS",
646
+ "links": [
647
+ 24
648
+ ],
649
+ "shape": 3,
650
+ "slot_index": 0
651
+ },
652
+ {
653
+ "name": "neg_embed",
654
+ "type": "EMBEDS",
655
+ "links": [
656
+ 29
657
+ ],
658
+ "shape": 3,
659
+ "slot_index": 1
660
+ }
661
+ ],
662
+ "properties": {
663
+ "Node name for S&R": "IPAdapterEncoder"
664
+ },
665
+ "widgets_values": [
666
+ 0.6
667
+ ]
668
+ }
669
+ ],
670
+ "links": [
671
+ [
672
+ 2,
673
+ 5,
674
+ 0,
675
+ 3,
676
+ 3,
677
+ "LATENT"
678
+ ],
679
+ [
680
+ 3,
681
+ 4,
682
+ 1,
683
+ 6,
684
+ 0,
685
+ "CLIP"
686
+ ],
687
+ [
688
+ 4,
689
+ 6,
690
+ 0,
691
+ 3,
692
+ 1,
693
+ "CONDITIONING"
694
+ ],
695
+ [
696
+ 5,
697
+ 4,
698
+ 1,
699
+ 7,
700
+ 0,
701
+ "CLIP"
702
+ ],
703
+ [
704
+ 6,
705
+ 7,
706
+ 0,
707
+ 3,
708
+ 2,
709
+ "CONDITIONING"
710
+ ],
711
+ [
712
+ 7,
713
+ 3,
714
+ 0,
715
+ 8,
716
+ 0,
717
+ "LATENT"
718
+ ],
719
+ [
720
+ 8,
721
+ 4,
722
+ 2,
723
+ 8,
724
+ 1,
725
+ "VAE"
726
+ ],
727
+ [
728
+ 9,
729
+ 8,
730
+ 0,
731
+ 9,
732
+ 0,
733
+ "IMAGE"
734
+ ],
735
+ [
736
+ 10,
737
+ 4,
738
+ 0,
739
+ 11,
740
+ 0,
741
+ "MODEL"
742
+ ],
743
+ [
744
+ 19,
745
+ 11,
746
+ 0,
747
+ 14,
748
+ 0,
749
+ "MODEL"
750
+ ],
751
+ [
752
+ 20,
753
+ 11,
754
+ 1,
755
+ 16,
756
+ 0,
757
+ "IPADAPTER"
758
+ ],
759
+ [
760
+ 21,
761
+ 12,
762
+ 0,
763
+ 16,
764
+ 1,
765
+ "IMAGE"
766
+ ],
767
+ [
768
+ 22,
769
+ 11,
770
+ 1,
771
+ 17,
772
+ 0,
773
+ "IPADAPTER"
774
+ ],
775
+ [
776
+ 23,
777
+ 15,
778
+ 0,
779
+ 17,
780
+ 1,
781
+ "IMAGE"
782
+ ],
783
+ [
784
+ 24,
785
+ 16,
786
+ 0,
787
+ 18,
788
+ 0,
789
+ "EMBEDS"
790
+ ],
791
+ [
792
+ 25,
793
+ 17,
794
+ 0,
795
+ 18,
796
+ 1,
797
+ "EMBEDS"
798
+ ],
799
+ [
800
+ 26,
801
+ 18,
802
+ 0,
803
+ 14,
804
+ 2,
805
+ "EMBEDS"
806
+ ],
807
+ [
808
+ 27,
809
+ 11,
810
+ 1,
811
+ 14,
812
+ 1,
813
+ "IPADAPTER"
814
+ ],
815
+ [
816
+ 28,
817
+ 14,
818
+ 0,
819
+ 3,
820
+ 0,
821
+ "MODEL"
822
+ ],
823
+ [
824
+ 29,
825
+ 16,
826
+ 1,
827
+ 14,
828
+ 3,
829
+ "EMBEDS"
830
+ ]
831
+ ],
832
+ "groups": [],
833
+ "config": {},
834
+ "extra": {},
835
+ "version": 0.4
836
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/examples/ipadapter_weights.json ADDED
@@ -0,0 +1,764 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 22,
3
+ "last_link_id": 40,
4
+ "nodes": [
5
+ {
6
+ "id": 7,
7
+ "type": "CLIPTextEncode",
8
+ "pos": [
9
+ 690,
10
+ 840
11
+ ],
12
+ "size": {
13
+ "0": 425.27801513671875,
14
+ "1": 180.6060791015625
15
+ },
16
+ "flags": {},
17
+ "order": 5,
18
+ "mode": 0,
19
+ "inputs": [
20
+ {
21
+ "name": "clip",
22
+ "type": "CLIP",
23
+ "link": 5
24
+ }
25
+ ],
26
+ "outputs": [
27
+ {
28
+ "name": "CONDITIONING",
29
+ "type": "CONDITIONING",
30
+ "links": [
31
+ 6
32
+ ],
33
+ "slot_index": 0
34
+ }
35
+ ],
36
+ "properties": {
37
+ "Node name for S&R": "CLIPTextEncode"
38
+ },
39
+ "widgets_values": [
40
+ "blurry, noisy, messy, lowres, jpeg, artifacts, ill, distorted, malformed"
41
+ ]
42
+ },
43
+ {
44
+ "id": 8,
45
+ "type": "VAEDecode",
46
+ "pos": [
47
+ 1570,
48
+ 700
49
+ ],
50
+ "size": {
51
+ "0": 140,
52
+ "1": 46
53
+ },
54
+ "flags": {},
55
+ "order": 11,
56
+ "mode": 0,
57
+ "inputs": [
58
+ {
59
+ "name": "samples",
60
+ "type": "LATENT",
61
+ "link": 7
62
+ },
63
+ {
64
+ "name": "vae",
65
+ "type": "VAE",
66
+ "link": 8
67
+ }
68
+ ],
69
+ "outputs": [
70
+ {
71
+ "name": "IMAGE",
72
+ "type": "IMAGE",
73
+ "links": [
74
+ 9
75
+ ],
76
+ "slot_index": 0
77
+ }
78
+ ],
79
+ "properties": {
80
+ "Node name for S&R": "VAEDecode"
81
+ }
82
+ },
83
+ {
84
+ "id": 6,
85
+ "type": "CLIPTextEncode",
86
+ "pos": [
87
+ 690,
88
+ 610
89
+ ],
90
+ "size": {
91
+ "0": 422.84503173828125,
92
+ "1": 164.31304931640625
93
+ },
94
+ "flags": {},
95
+ "order": 4,
96
+ "mode": 0,
97
+ "inputs": [
98
+ {
99
+ "name": "clip",
100
+ "type": "CLIP",
101
+ "link": 3
102
+ }
103
+ ],
104
+ "outputs": [
105
+ {
106
+ "name": "CONDITIONING",
107
+ "type": "CONDITIONING",
108
+ "links": [
109
+ 4
110
+ ],
111
+ "slot_index": 0
112
+ }
113
+ ],
114
+ "properties": {
115
+ "Node name for S&R": "CLIPTextEncode"
116
+ },
117
+ "widgets_values": [
118
+ "in a peaceful spring morning a woman wearing a white shirt is sitting in a park on a bench\n\nhigh quality, detailed, diffuse light"
119
+ ]
120
+ },
121
+ {
122
+ "id": 3,
123
+ "type": "KSampler",
124
+ "pos": [
125
+ 1210,
126
+ 700
127
+ ],
128
+ "size": {
129
+ "0": 315,
130
+ "1": 262
131
+ },
132
+ "flags": {},
133
+ "order": 10,
134
+ "mode": 0,
135
+ "inputs": [
136
+ {
137
+ "name": "model",
138
+ "type": "MODEL",
139
+ "link": 31
140
+ },
141
+ {
142
+ "name": "positive",
143
+ "type": "CONDITIONING",
144
+ "link": 4
145
+ },
146
+ {
147
+ "name": "negative",
148
+ "type": "CONDITIONING",
149
+ "link": 6
150
+ },
151
+ {
152
+ "name": "latent_image",
153
+ "type": "LATENT",
154
+ "link": 2
155
+ }
156
+ ],
157
+ "outputs": [
158
+ {
159
+ "name": "LATENT",
160
+ "type": "LATENT",
161
+ "links": [
162
+ 7
163
+ ],
164
+ "slot_index": 0
165
+ }
166
+ ],
167
+ "properties": {
168
+ "Node name for S&R": "KSampler"
169
+ },
170
+ "widgets_values": [
171
+ 0,
172
+ "fixed",
173
+ 30,
174
+ 6.5,
175
+ "ddpm",
176
+ "karras",
177
+ 1
178
+ ]
179
+ },
180
+ {
181
+ "id": 19,
182
+ "type": "IPAdapterBatch",
183
+ "pos": [
184
+ 1173,
185
+ 251
186
+ ],
187
+ "size": {
188
+ "0": 315,
189
+ "1": 254
190
+ },
191
+ "flags": {},
192
+ "order": 9,
193
+ "mode": 0,
194
+ "inputs": [
195
+ {
196
+ "name": "model",
197
+ "type": "MODEL",
198
+ "link": 37
199
+ },
200
+ {
201
+ "name": "ipadapter",
202
+ "type": "IPADAPTER",
203
+ "link": 29
204
+ },
205
+ {
206
+ "name": "image",
207
+ "type": "IMAGE",
208
+ "link": 30
209
+ },
210
+ {
211
+ "name": "image_negative",
212
+ "type": "IMAGE",
213
+ "link": null
214
+ },
215
+ {
216
+ "name": "attn_mask",
217
+ "type": "MASK",
218
+ "link": null
219
+ },
220
+ {
221
+ "name": "clip_vision",
222
+ "type": "CLIP_VISION",
223
+ "link": null
224
+ },
225
+ {
226
+ "name": "weight",
227
+ "type": "FLOAT",
228
+ "link": 38,
229
+ "widget": {
230
+ "name": "weight"
231
+ },
232
+ "slot_index": 6
233
+ }
234
+ ],
235
+ "outputs": [
236
+ {
237
+ "name": "MODEL",
238
+ "type": "MODEL",
239
+ "links": [
240
+ 31
241
+ ],
242
+ "shape": 3,
243
+ "slot_index": 0
244
+ }
245
+ ],
246
+ "properties": {
247
+ "Node name for S&R": "IPAdapterBatch"
248
+ },
249
+ "widgets_values": [
250
+ 1,
251
+ "linear",
252
+ 0,
253
+ 1,
254
+ "V only"
255
+ ]
256
+ },
257
+ {
258
+ "id": 18,
259
+ "type": "IPAdapterUnifiedLoader",
260
+ "pos": [
261
+ 303,
262
+ 132
263
+ ],
264
+ "size": {
265
+ "0": 315,
266
+ "1": 78
267
+ },
268
+ "flags": {},
269
+ "order": 3,
270
+ "mode": 0,
271
+ "inputs": [
272
+ {
273
+ "name": "model",
274
+ "type": "MODEL",
275
+ "link": 36
276
+ },
277
+ {
278
+ "name": "ipadapter",
279
+ "type": "IPADAPTER",
280
+ "link": null
281
+ }
282
+ ],
283
+ "outputs": [
284
+ {
285
+ "name": "model",
286
+ "type": "MODEL",
287
+ "links": [
288
+ 37
289
+ ],
290
+ "shape": 3,
291
+ "slot_index": 0
292
+ },
293
+ {
294
+ "name": "ipadapter",
295
+ "type": "IPADAPTER",
296
+ "links": [
297
+ 29
298
+ ],
299
+ "shape": 3
300
+ }
301
+ ],
302
+ "properties": {
303
+ "Node name for S&R": "IPAdapterUnifiedLoader"
304
+ },
305
+ "widgets_values": [
306
+ "PLUS (high strength)"
307
+ ]
308
+ },
309
+ {
310
+ "id": 4,
311
+ "type": "CheckpointLoaderSimple",
312
+ "pos": [
313
+ -79,
314
+ 712
315
+ ],
316
+ "size": {
317
+ "0": 315,
318
+ "1": 98
319
+ },
320
+ "flags": {},
321
+ "order": 0,
322
+ "mode": 0,
323
+ "outputs": [
324
+ {
325
+ "name": "MODEL",
326
+ "type": "MODEL",
327
+ "links": [
328
+ 36
329
+ ],
330
+ "slot_index": 0
331
+ },
332
+ {
333
+ "name": "CLIP",
334
+ "type": "CLIP",
335
+ "links": [
336
+ 3,
337
+ 5
338
+ ],
339
+ "slot_index": 1
340
+ },
341
+ {
342
+ "name": "VAE",
343
+ "type": "VAE",
344
+ "links": [
345
+ 8
346
+ ],
347
+ "slot_index": 2
348
+ }
349
+ ],
350
+ "properties": {
351
+ "Node name for S&R": "CheckpointLoaderSimple"
352
+ },
353
+ "widgets_values": [
354
+ "sd15/realisticVisionV51_v51VAE.safetensors"
355
+ ]
356
+ },
357
+ {
358
+ "id": 17,
359
+ "type": "PrepImageForClipVision",
360
+ "pos": [
361
+ 788,
362
+ 43
363
+ ],
364
+ "size": {
365
+ "0": 315,
366
+ "1": 106
367
+ },
368
+ "flags": {},
369
+ "order": 6,
370
+ "mode": 0,
371
+ "inputs": [
372
+ {
373
+ "name": "image",
374
+ "type": "IMAGE",
375
+ "link": 25
376
+ }
377
+ ],
378
+ "outputs": [
379
+ {
380
+ "name": "IMAGE",
381
+ "type": "IMAGE",
382
+ "links": [
383
+ 30
384
+ ],
385
+ "shape": 3,
386
+ "slot_index": 0
387
+ }
388
+ ],
389
+ "properties": {
390
+ "Node name for S&R": "PrepImageForClipVision"
391
+ },
392
+ "widgets_values": [
393
+ "LANCZOS",
394
+ "top",
395
+ 0.15
396
+ ]
397
+ },
398
+ {
399
+ "id": 9,
400
+ "type": "SaveImage",
401
+ "pos": [
402
+ 1770,
403
+ 710
404
+ ],
405
+ "size": {
406
+ "0": 556.2374267578125,
407
+ "1": 892.1895751953125
408
+ },
409
+ "flags": {},
410
+ "order": 12,
411
+ "mode": 0,
412
+ "inputs": [
413
+ {
414
+ "name": "images",
415
+ "type": "IMAGE",
416
+ "link": 9
417
+ }
418
+ ],
419
+ "properties": {},
420
+ "widgets_values": [
421
+ "IPAdapter"
422
+ ]
423
+ },
424
+ {
425
+ "id": 12,
426
+ "type": "LoadImage",
427
+ "pos": [
428
+ 311,
429
+ 270
430
+ ],
431
+ "size": {
432
+ "0": 315,
433
+ "1": 314
434
+ },
435
+ "flags": {},
436
+ "order": 1,
437
+ "mode": 0,
438
+ "outputs": [
439
+ {
440
+ "name": "IMAGE",
441
+ "type": "IMAGE",
442
+ "links": [
443
+ 25
444
+ ],
445
+ "shape": 3,
446
+ "slot_index": 0
447
+ },
448
+ {
449
+ "name": "MASK",
450
+ "type": "MASK",
451
+ "links": null,
452
+ "shape": 3
453
+ }
454
+ ],
455
+ "properties": {
456
+ "Node name for S&R": "LoadImage"
457
+ },
458
+ "widgets_values": [
459
+ "warrior_woman.png",
460
+ "image"
461
+ ]
462
+ },
463
+ {
464
+ "id": 5,
465
+ "type": "EmptyLatentImage",
466
+ "pos": [
467
+ 801,
468
+ 1097
469
+ ],
470
+ "size": [
471
+ 309.1109879864148,
472
+ 82
473
+ ],
474
+ "flags": {},
475
+ "order": 7,
476
+ "mode": 0,
477
+ "inputs": [
478
+ {
479
+ "name": "batch_size",
480
+ "type": "INT",
481
+ "link": 35,
482
+ "widget": {
483
+ "name": "batch_size"
484
+ }
485
+ }
486
+ ],
487
+ "outputs": [
488
+ {
489
+ "name": "LATENT",
490
+ "type": "LATENT",
491
+ "links": [
492
+ 2
493
+ ],
494
+ "slot_index": 0
495
+ }
496
+ ],
497
+ "properties": {
498
+ "Node name for S&R": "EmptyLatentImage"
499
+ },
500
+ "widgets_values": [
501
+ 512,
502
+ 512,
503
+ 6
504
+ ]
505
+ },
506
+ {
507
+ "id": 21,
508
+ "type": "PrimitiveNode",
509
+ "pos": [
510
+ 340,
511
+ 1093
512
+ ],
513
+ "size": {
514
+ "0": 210,
515
+ "1": 82
516
+ },
517
+ "flags": {},
518
+ "order": 2,
519
+ "mode": 0,
520
+ "outputs": [
521
+ {
522
+ "name": "INT",
523
+ "type": "INT",
524
+ "links": [
525
+ 35,
526
+ 40
527
+ ],
528
+ "widget": {
529
+ "name": "batch_size"
530
+ },
531
+ "slot_index": 0
532
+ }
533
+ ],
534
+ "title": "frames",
535
+ "properties": {
536
+ "Run widget replace on values": false
537
+ },
538
+ "widgets_values": [
539
+ 6,
540
+ "fixed"
541
+ ]
542
+ },
543
+ {
544
+ "id": 22,
545
+ "type": "IPAdapterWeights",
546
+ "pos": [
547
+ 761,
548
+ 208
549
+ ],
550
+ "size": [
551
+ 299.9049990375719,
552
+ 324.00000762939453
553
+ ],
554
+ "flags": {},
555
+ "order": 8,
556
+ "mode": 0,
557
+ "inputs": [
558
+ {
559
+ "name": "image",
560
+ "type": "IMAGE",
561
+ "link": null
562
+ },
563
+ {
564
+ "name": "frames",
565
+ "type": "INT",
566
+ "link": 40,
567
+ "widget": {
568
+ "name": "frames"
569
+ }
570
+ }
571
+ ],
572
+ "outputs": [
573
+ {
574
+ "name": "weights",
575
+ "type": "FLOAT",
576
+ "links": [
577
+ 38
578
+ ],
579
+ "shape": 3,
580
+ "slot_index": 0
581
+ },
582
+ {
583
+ "name": "weights_invert",
584
+ "type": "FLOAT",
585
+ "links": null,
586
+ "shape": 3
587
+ },
588
+ {
589
+ "name": "total_frames",
590
+ "type": "INT",
591
+ "links": null,
592
+ "shape": 3
593
+ },
594
+ {
595
+ "name": "image_1",
596
+ "type": "IMAGE",
597
+ "links": null,
598
+ "shape": 3
599
+ },
600
+ {
601
+ "name": "image_2",
602
+ "type": "IMAGE",
603
+ "links": null,
604
+ "shape": 3
605
+ }
606
+ ],
607
+ "properties": {
608
+ "Node name for S&R": "IPAdapterWeights"
609
+ },
610
+ "widgets_values": [
611
+ "1.0, 0.0",
612
+ "linear",
613
+ 6,
614
+ 0,
615
+ 9999,
616
+ 0,
617
+ 0,
618
+ "full batch"
619
+ ]
620
+ }
621
+ ],
622
+ "links": [
623
+ [
624
+ 2,
625
+ 5,
626
+ 0,
627
+ 3,
628
+ 3,
629
+ "LATENT"
630
+ ],
631
+ [
632
+ 3,
633
+ 4,
634
+ 1,
635
+ 6,
636
+ 0,
637
+ "CLIP"
638
+ ],
639
+ [
640
+ 4,
641
+ 6,
642
+ 0,
643
+ 3,
644
+ 1,
645
+ "CONDITIONING"
646
+ ],
647
+ [
648
+ 5,
649
+ 4,
650
+ 1,
651
+ 7,
652
+ 0,
653
+ "CLIP"
654
+ ],
655
+ [
656
+ 6,
657
+ 7,
658
+ 0,
659
+ 3,
660
+ 2,
661
+ "CONDITIONING"
662
+ ],
663
+ [
664
+ 7,
665
+ 3,
666
+ 0,
667
+ 8,
668
+ 0,
669
+ "LATENT"
670
+ ],
671
+ [
672
+ 8,
673
+ 4,
674
+ 2,
675
+ 8,
676
+ 1,
677
+ "VAE"
678
+ ],
679
+ [
680
+ 9,
681
+ 8,
682
+ 0,
683
+ 9,
684
+ 0,
685
+ "IMAGE"
686
+ ],
687
+ [
688
+ 25,
689
+ 12,
690
+ 0,
691
+ 17,
692
+ 0,
693
+ "IMAGE"
694
+ ],
695
+ [
696
+ 29,
697
+ 18,
698
+ 1,
699
+ 19,
700
+ 1,
701
+ "IPADAPTER"
702
+ ],
703
+ [
704
+ 30,
705
+ 17,
706
+ 0,
707
+ 19,
708
+ 2,
709
+ "IMAGE"
710
+ ],
711
+ [
712
+ 31,
713
+ 19,
714
+ 0,
715
+ 3,
716
+ 0,
717
+ "MODEL"
718
+ ],
719
+ [
720
+ 35,
721
+ 21,
722
+ 0,
723
+ 5,
724
+ 0,
725
+ "INT"
726
+ ],
727
+ [
728
+ 36,
729
+ 4,
730
+ 0,
731
+ 18,
732
+ 0,
733
+ "MODEL"
734
+ ],
735
+ [
736
+ 37,
737
+ 18,
738
+ 0,
739
+ 19,
740
+ 0,
741
+ "MODEL"
742
+ ],
743
+ [
744
+ 38,
745
+ 22,
746
+ 0,
747
+ 19,
748
+ 6,
749
+ "FLOAT"
750
+ ],
751
+ [
752
+ 40,
753
+ 21,
754
+ 0,
755
+ 22,
756
+ 1,
757
+ "INT"
758
+ ]
759
+ ],
760
+ "groups": [],
761
+ "config": {},
762
+ "extra": {},
763
+ "version": 0.4
764
+ }
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/image_proj_models.py ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import torch
3
+ import torch.nn as nn
4
+ from einops import rearrange
5
+ from einops.layers.torch import Rearrange
6
+
7
+
8
+ # FFN
9
+ def FeedForward(dim, mult=4):
10
+ inner_dim = int(dim * mult)
11
+ return nn.Sequential(
12
+ nn.LayerNorm(dim),
13
+ nn.Linear(dim, inner_dim, bias=False),
14
+ nn.GELU(),
15
+ nn.Linear(inner_dim, dim, bias=False),
16
+ )
17
+
18
+
19
+ def reshape_tensor(x, heads):
20
+ bs, length, width = x.shape
21
+ # (bs, length, width) --> (bs, length, n_heads, dim_per_head)
22
+ x = x.view(bs, length, heads, -1)
23
+ # (bs, length, n_heads, dim_per_head) --> (bs, n_heads, length, dim_per_head)
24
+ x = x.transpose(1, 2)
25
+ # (bs, n_heads, length, dim_per_head) --> (bs*n_heads, length, dim_per_head)
26
+ x = x.reshape(bs, heads, length, -1)
27
+ return x
28
+
29
+
30
+ class PerceiverAttention(nn.Module):
31
+ def __init__(self, *, dim, dim_head=64, heads=8):
32
+ super().__init__()
33
+ self.scale = dim_head**-0.5
34
+ self.dim_head = dim_head
35
+ self.heads = heads
36
+ inner_dim = dim_head * heads
37
+
38
+ self.norm1 = nn.LayerNorm(dim)
39
+ self.norm2 = nn.LayerNorm(dim)
40
+
41
+ self.to_q = nn.Linear(dim, inner_dim, bias=False)
42
+ self.to_kv = nn.Linear(dim, inner_dim * 2, bias=False)
43
+ self.to_out = nn.Linear(inner_dim, dim, bias=False)
44
+
45
+ def forward(self, x, latents):
46
+ """
47
+ Args:
48
+ x (torch.Tensor): image features
49
+ shape (b, n1, D)
50
+ latent (torch.Tensor): latent features
51
+ shape (b, n2, D)
52
+ """
53
+ x = self.norm1(x)
54
+ latents = self.norm2(latents)
55
+
56
+ b, l, _ = latents.shape
57
+
58
+ q = self.to_q(latents)
59
+ kv_input = torch.cat((x, latents), dim=-2)
60
+ k, v = self.to_kv(kv_input).chunk(2, dim=-1)
61
+
62
+ q = reshape_tensor(q, self.heads)
63
+ k = reshape_tensor(k, self.heads)
64
+ v = reshape_tensor(v, self.heads)
65
+
66
+ # attention
67
+ scale = 1 / math.sqrt(math.sqrt(self.dim_head))
68
+ weight = (q * scale) @ (k * scale).transpose(-2, -1) # More stable with f16 than dividing afterwards
69
+ weight = torch.softmax(weight.float(), dim=-1).type(weight.dtype)
70
+ out = weight @ v
71
+
72
+ out = out.permute(0, 2, 1, 3).reshape(b, l, -1)
73
+
74
+ return self.to_out(out)
75
+
76
+
77
+ class Resampler(nn.Module):
78
+ def __init__(
79
+ self,
80
+ dim=1024,
81
+ depth=8,
82
+ dim_head=64,
83
+ heads=16,
84
+ num_queries=8,
85
+ embedding_dim=768,
86
+ output_dim=1024,
87
+ ff_mult=4,
88
+ max_seq_len: int = 257, # CLIP tokens + CLS token
89
+ apply_pos_emb: bool = False,
90
+ num_latents_mean_pooled: int = 0, # number of latents derived from mean pooled representation of the sequence
91
+ ):
92
+ super().__init__()
93
+ self.pos_emb = nn.Embedding(max_seq_len, embedding_dim) if apply_pos_emb else None
94
+
95
+ self.latents = nn.Parameter(torch.randn(1, num_queries, dim) / dim**0.5)
96
+
97
+ self.proj_in = nn.Linear(embedding_dim, dim)
98
+
99
+ self.proj_out = nn.Linear(dim, output_dim)
100
+ self.norm_out = nn.LayerNorm(output_dim)
101
+
102
+ self.to_latents_from_mean_pooled_seq = (
103
+ nn.Sequential(
104
+ nn.LayerNorm(dim),
105
+ nn.Linear(dim, dim * num_latents_mean_pooled),
106
+ Rearrange("b (n d) -> b n d", n=num_latents_mean_pooled),
107
+ )
108
+ if num_latents_mean_pooled > 0
109
+ else None
110
+ )
111
+
112
+ self.layers = nn.ModuleList([])
113
+ for _ in range(depth):
114
+ self.layers.append(
115
+ nn.ModuleList(
116
+ [
117
+ PerceiverAttention(dim=dim, dim_head=dim_head, heads=heads),
118
+ FeedForward(dim=dim, mult=ff_mult),
119
+ ]
120
+ )
121
+ )
122
+
123
+ def forward(self, x):
124
+ if self.pos_emb is not None:
125
+ n, device = x.shape[1], x.device
126
+ pos_emb = self.pos_emb(torch.arange(n, device=device))
127
+ x = x + pos_emb
128
+
129
+ latents = self.latents.repeat(x.size(0), 1, 1)
130
+
131
+ x = self.proj_in(x)
132
+
133
+ if self.to_latents_from_mean_pooled_seq:
134
+ meanpooled_seq = masked_mean(x, dim=1, mask=torch.ones(x.shape[:2], device=x.device, dtype=torch.bool))
135
+ meanpooled_latents = self.to_latents_from_mean_pooled_seq(meanpooled_seq)
136
+ latents = torch.cat((meanpooled_latents, latents), dim=-2)
137
+
138
+ for attn, ff in self.layers:
139
+ latents = attn(x, latents) + latents
140
+ latents = ff(latents) + latents
141
+
142
+ latents = self.proj_out(latents)
143
+ return self.norm_out(latents)
144
+
145
+
146
+ def masked_mean(t, *, dim, mask=None):
147
+ if mask is None:
148
+ return t.mean(dim=dim)
149
+
150
+ denom = mask.sum(dim=dim, keepdim=True)
151
+ mask = rearrange(mask, "b n -> b n 1")
152
+ masked_t = t.masked_fill(~mask, 0.0)
153
+
154
+ return masked_t.sum(dim=dim) / denom.clamp(min=1e-5)
155
+
156
+
157
+ class FacePerceiverResampler(nn.Module):
158
+ def __init__(
159
+ self,
160
+ *,
161
+ dim=768,
162
+ depth=4,
163
+ dim_head=64,
164
+ heads=16,
165
+ embedding_dim=1280,
166
+ output_dim=768,
167
+ ff_mult=4,
168
+ ):
169
+ super().__init__()
170
+
171
+ self.proj_in = nn.Linear(embedding_dim, dim)
172
+ self.proj_out = nn.Linear(dim, output_dim)
173
+ self.norm_out = nn.LayerNorm(output_dim)
174
+ self.layers = nn.ModuleList([])
175
+ for _ in range(depth):
176
+ self.layers.append(
177
+ nn.ModuleList(
178
+ [
179
+ PerceiverAttention(dim=dim, dim_head=dim_head, heads=heads),
180
+ FeedForward(dim=dim, mult=ff_mult),
181
+ ]
182
+ )
183
+ )
184
+
185
+ def forward(self, latents, x):
186
+ x = self.proj_in(x)
187
+ for attn, ff in self.layers:
188
+ latents = attn(x, latents) + latents
189
+ latents = ff(latents) + latents
190
+ latents = self.proj_out(latents)
191
+ return self.norm_out(latents)
192
+
193
+
194
+ class MLPProjModel(nn.Module):
195
+ def __init__(self, cross_attention_dim=1024, clip_embeddings_dim=1024):
196
+ super().__init__()
197
+
198
+ self.proj = nn.Sequential(
199
+ nn.Linear(clip_embeddings_dim, clip_embeddings_dim),
200
+ nn.GELU(),
201
+ nn.Linear(clip_embeddings_dim, cross_attention_dim),
202
+ nn.LayerNorm(cross_attention_dim)
203
+ )
204
+
205
+ def forward(self, image_embeds):
206
+ clip_extra_context_tokens = self.proj(image_embeds)
207
+ return clip_extra_context_tokens
208
+
209
+ class MLPProjModelFaceId(nn.Module):
210
+ def __init__(self, cross_attention_dim=768, id_embeddings_dim=512, num_tokens=4):
211
+ super().__init__()
212
+
213
+ self.cross_attention_dim = cross_attention_dim
214
+ self.num_tokens = num_tokens
215
+
216
+ self.proj = nn.Sequential(
217
+ nn.Linear(id_embeddings_dim, id_embeddings_dim*2),
218
+ nn.GELU(),
219
+ nn.Linear(id_embeddings_dim*2, cross_attention_dim*num_tokens),
220
+ )
221
+ self.norm = nn.LayerNorm(cross_attention_dim)
222
+
223
+ def forward(self, id_embeds):
224
+ x = self.proj(id_embeds)
225
+ x = x.reshape(-1, self.num_tokens, self.cross_attention_dim)
226
+ x = self.norm(x)
227
+ return x
228
+
229
+ class ProjModelFaceIdPlus(nn.Module):
230
+ def __init__(self, cross_attention_dim=768, id_embeddings_dim=512, clip_embeddings_dim=1280, num_tokens=4):
231
+ super().__init__()
232
+
233
+ self.cross_attention_dim = cross_attention_dim
234
+ self.num_tokens = num_tokens
235
+
236
+ self.proj = nn.Sequential(
237
+ nn.Linear(id_embeddings_dim, id_embeddings_dim*2),
238
+ nn.GELU(),
239
+ nn.Linear(id_embeddings_dim*2, cross_attention_dim*num_tokens),
240
+ )
241
+ self.norm = nn.LayerNorm(cross_attention_dim)
242
+
243
+ self.perceiver_resampler = FacePerceiverResampler(
244
+ dim=cross_attention_dim,
245
+ depth=4,
246
+ dim_head=64,
247
+ heads=cross_attention_dim // 64,
248
+ embedding_dim=clip_embeddings_dim,
249
+ output_dim=cross_attention_dim,
250
+ ff_mult=4,
251
+ )
252
+
253
+ def forward(self, id_embeds, clip_embeds, scale=1.0, shortcut=False):
254
+ x = self.proj(id_embeds)
255
+ x = x.reshape(-1, self.num_tokens, self.cross_attention_dim)
256
+ x = self.norm(x)
257
+ out = self.perceiver_resampler(x, clip_embeds)
258
+ if shortcut:
259
+ out = x + scale * out
260
+ return out
261
+
262
+ class ImageProjModel(nn.Module):
263
+ def __init__(self, cross_attention_dim=1024, clip_embeddings_dim=1024, clip_extra_context_tokens=4):
264
+ super().__init__()
265
+
266
+ self.cross_attention_dim = cross_attention_dim
267
+ self.clip_extra_context_tokens = clip_extra_context_tokens
268
+ self.proj = nn.Linear(clip_embeddings_dim, self.clip_extra_context_tokens * cross_attention_dim)
269
+ self.norm = nn.LayerNorm(cross_attention_dim)
270
+
271
+ def forward(self, image_embeds):
272
+ embeds = image_embeds
273
+ x = self.proj(embeds).reshape(-1, self.clip_extra_context_tokens, self.cross_attention_dim)
274
+ x = self.norm(x)
275
+ return x
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/models/legacy_directory_do_not_use.txt ADDED
File without changes
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/pyproject.toml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "comfyui_ipadapter_plus"
3
+ description = "ComfyUI reference implementation for the IPAdapter models. The IPAdapter are very powerful models for image conditioning. The style and composition of a reference can be easily transferred to the generation. Think of it as a 1-image lora."
4
+ version = "2.0.0"
5
+ license = "GPL-3.0 license"
6
+
7
+ [project.urls]
8
+ Repository = "https://github.com/cubiq/ComfyUI_IPAdapter_plus"
9
+ # Used by Comfy Registry https://comfyregistry.org
10
+
11
+ [tool.comfy]
12
+ PublisherId = "matteo"
13
+ DisplayName = "ComfyUI_IPAdapter_plus"
14
+ Icon = ""
ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/utils.py ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import torch
3
+ import os
4
+ import folder_paths
5
+ from comfy.clip_vision import clip_preprocess, Output
6
+ import comfy.utils
7
+ import comfy.model_management as model_management
8
+ try:
9
+ import torchvision.transforms.v2 as T
10
+ except ImportError:
11
+ import torchvision.transforms as T
12
+
13
+ def get_clipvision_file(preset):
14
+ preset = preset.lower()
15
+ clipvision_list = folder_paths.get_filename_list("clip_vision")
16
+
17
+ if preset.startswith("vit-g"):
18
+ pattern = r'(ViT.bigG.14.*39B.b160k|ipadapter.*sdxl|sdxl.*model\.(bin|safetensors))'
19
+ elif preset.startswith("kolors"):
20
+ pattern = r'(clip.vit.large.patch14.336\.(bin|safetensors))'
21
+ else:
22
+ pattern = r'(ViT.H.14.*s32B.b79K|ipadapter.*sd15|sd1.?5.*model\.(bin|safetensors))'
23
+ clipvision_file = [e for e in clipvision_list if re.search(pattern, e, re.IGNORECASE)]
24
+
25
+ clipvision_file = folder_paths.get_full_path("clip_vision", clipvision_file[0]) if clipvision_file else None
26
+
27
+ return clipvision_file
28
+
29
+ def get_ipadapter_file(preset, is_sdxl):
30
+ preset = preset.lower()
31
+ ipadapter_list = folder_paths.get_filename_list("ipadapter")
32
+ is_insightface = False
33
+ lora_pattern = None
34
+
35
+ if preset.startswith("light"):
36
+ if is_sdxl:
37
+ raise Exception("light model is not supported for SDXL")
38
+ pattern = r'sd15.light.v11\.(safetensors|bin)$'
39
+ # if v11 is not found, try with the old version
40
+ if not [e for e in ipadapter_list if re.search(pattern, e, re.IGNORECASE)]:
41
+ pattern = r'sd15.light\.(safetensors|bin)$'
42
+ elif preset.startswith("standard"):
43
+ if is_sdxl:
44
+ pattern = r'ip.adapter.sdxl.vit.h\.(safetensors|bin)$'
45
+ else:
46
+ pattern = r'ip.adapter.sd15\.(safetensors|bin)$'
47
+ elif preset.startswith("vit-g"):
48
+ if is_sdxl:
49
+ pattern = r'ip.adapter.sdxl\.(safetensors|bin)$'
50
+ else:
51
+ pattern = r'sd15.vit.g\.(safetensors|bin)$'
52
+ elif preset.startswith("plus ("):
53
+ if is_sdxl:
54
+ pattern = r'plus.sdxl.vit.h\.(safetensors|bin)$'
55
+ else:
56
+ pattern = r'ip.adapter.plus.sd15\.(safetensors|bin)$'
57
+ elif preset.startswith("plus face"):
58
+ if is_sdxl:
59
+ pattern = r'plus.face.sdxl.vit.h\.(safetensors|bin)$'
60
+ else:
61
+ pattern = r'plus.face.sd15\.(safetensors|bin)$'
62
+ elif preset.startswith("full"):
63
+ if is_sdxl:
64
+ raise Exception("full face model is not supported for SDXL")
65
+ pattern = r'full.face.sd15\.(safetensors|bin)$'
66
+ elif preset.startswith("faceid portrait ("):
67
+ if is_sdxl:
68
+ pattern = r'portrait.sdxl\.(safetensors|bin)$'
69
+ else:
70
+ pattern = r'portrait.v11.sd15\.(safetensors|bin)$'
71
+ # if v11 is not found, try with the old version
72
+ if not [e for e in ipadapter_list if re.search(pattern, e, re.IGNORECASE)]:
73
+ pattern = r'portrait.sd15\.(safetensors|bin)$'
74
+ is_insightface = True
75
+ elif preset.startswith("faceid portrait unnorm"):
76
+ if is_sdxl:
77
+ pattern = r'portrait.sdxl.unnorm\.(safetensors|bin)$'
78
+ else:
79
+ raise Exception("portrait unnorm model is not supported for SD1.5")
80
+ is_insightface = True
81
+ elif preset == "faceid":
82
+ if is_sdxl:
83
+ pattern = r'faceid.sdxl\.(safetensors|bin)$'
84
+ lora_pattern = r'faceid.sdxl.lora\.safetensors$'
85
+ else:
86
+ pattern = r'faceid.sd15\.(safetensors|bin)$'
87
+ lora_pattern = r'faceid.sd15.lora\.safetensors$'
88
+ is_insightface = True
89
+ elif preset.startswith("faceid plus -"):
90
+ if is_sdxl:
91
+ raise Exception("faceid plus model is not supported for SDXL")
92
+ pattern = r'faceid.plus.sd15\.(safetensors|bin)$'
93
+ lora_pattern = r'faceid.plus.sd15.lora\.safetensors$'
94
+ is_insightface = True
95
+ elif preset.startswith("faceid plus v2"):
96
+ if is_sdxl:
97
+ pattern = r'faceid.plusv2.sdxl\.(safetensors|bin)$'
98
+ lora_pattern = r'faceid.plusv2.sdxl.lora\.safetensors$'
99
+ else:
100
+ pattern = r'faceid.plusv2.sd15\.(safetensors|bin)$'
101
+ lora_pattern = r'faceid.plusv2.sd15.lora\.safetensors$'
102
+ is_insightface = True
103
+ # Community's models
104
+ elif preset.startswith("composition"):
105
+ if is_sdxl:
106
+ pattern = r'plus.composition.sdxl\.safetensors$'
107
+ else:
108
+ pattern = r'plus.composition.sd15\.safetensors$'
109
+ elif preset.startswith("kolors"):
110
+ if is_sdxl:
111
+ pattern = r'(ip_adapter_plus_general|kolors.ip.adapter.plus)\.(safetensors|bin)$'
112
+ else:
113
+ raise Exception("Only supported for Kolors model")
114
+ else:
115
+ raise Exception(f"invalid type '{preset}'")
116
+
117
+ ipadapter_file = [e for e in ipadapter_list if re.search(pattern, e, re.IGNORECASE)]
118
+ ipadapter_file = folder_paths.get_full_path("ipadapter", ipadapter_file[0]) if ipadapter_file else None
119
+
120
+ return ipadapter_file, is_insightface, lora_pattern
121
+
122
+ def get_lora_file(pattern):
123
+ lora_list = folder_paths.get_filename_list("loras")
124
+ lora_file = [e for e in lora_list if re.search(pattern, e, re.IGNORECASE)]
125
+ lora_file = folder_paths.get_full_path("loras", lora_file[0]) if lora_file else None
126
+
127
+ return lora_file
128
+
129
+ def ipadapter_model_loader(file):
130
+ model = comfy.utils.load_torch_file(file, safe_load=True)
131
+
132
+ if file.lower().endswith(".safetensors"):
133
+ st_model = {"image_proj": {}, "ip_adapter": {}}
134
+ for key in model.keys():
135
+ if key.startswith("image_proj."):
136
+ st_model["image_proj"][key.replace("image_proj.", "")] = model[key]
137
+ elif key.startswith("ip_adapter."):
138
+ st_model["ip_adapter"][key.replace("ip_adapter.", "")] = model[key]
139
+ model = st_model
140
+ del st_model
141
+
142
+ if not "ip_adapter" in model.keys() or not model["ip_adapter"]:
143
+ raise Exception("invalid IPAdapter model {}".format(file))
144
+
145
+ if 'plusv2' in file.lower():
146
+ model["faceidplusv2"] = True
147
+
148
+ if 'unnorm' in file.lower():
149
+ model["portraitunnorm"] = True
150
+
151
+ return model
152
+
153
+ def insightface_loader(provider):
154
+ try:
155
+ from insightface.app import FaceAnalysis
156
+ except ImportError as e:
157
+ raise Exception(e)
158
+
159
+ path = os.path.join(folder_paths.models_dir, "insightface")
160
+ model = FaceAnalysis(name="buffalo_l", root=path, providers=[provider + 'ExecutionProvider',])
161
+ model.prepare(ctx_id=0, det_size=(640, 640))
162
+ return model
163
+
164
+ def split_tiles(embeds, num_split):
165
+ _, H, W, _ = embeds.shape
166
+ out = []
167
+ for x in embeds:
168
+ x = x.unsqueeze(0)
169
+ h, w = H // num_split, W // num_split
170
+ x_split = torch.cat([x[:, i*h:(i+1)*h, j*w:(j+1)*w, :] for i in range(num_split) for j in range(num_split)], dim=0)
171
+ out.append(x_split)
172
+
173
+ x_split = torch.stack(out, dim=0)
174
+
175
+ return x_split
176
+
177
+ def merge_hiddenstates(x, tiles):
178
+ chunk_size = tiles*tiles
179
+ x = x.split(chunk_size)
180
+
181
+ out = []
182
+ for embeds in x:
183
+ num_tiles = embeds.shape[0]
184
+ tile_size = int((embeds.shape[1]-1) ** 0.5)
185
+ grid_size = int(num_tiles ** 0.5)
186
+
187
+ # Extract class tokens
188
+ class_tokens = embeds[:, 0, :] # Save class tokens: [num_tiles, embeds[-1]]
189
+ avg_class_token = class_tokens.mean(dim=0, keepdim=True).unsqueeze(0) # Average token, shape: [1, 1, embeds[-1]]
190
+
191
+ patch_embeds = embeds[:, 1:, :] # Shape: [num_tiles, tile_size^2, embeds[-1]]
192
+ reshaped = patch_embeds.reshape(grid_size, grid_size, tile_size, tile_size, embeds.shape[-1])
193
+
194
+ merged = torch.cat([torch.cat([reshaped[i, j] for j in range(grid_size)], dim=1)
195
+ for i in range(grid_size)], dim=0)
196
+
197
+ merged = merged.unsqueeze(0) # Shape: [1, grid_size*tile_size, grid_size*tile_size, embeds[-1]]
198
+
199
+ # Pool to original size
200
+ pooled = torch.nn.functional.adaptive_avg_pool2d(merged.permute(0, 3, 1, 2), (tile_size, tile_size)).permute(0, 2, 3, 1)
201
+ flattened = pooled.reshape(1, tile_size*tile_size, embeds.shape[-1])
202
+
203
+ # Add back the class token
204
+ with_class = torch.cat([avg_class_token, flattened], dim=1) # Shape: original shape
205
+ out.append(with_class)
206
+
207
+ out = torch.cat(out, dim=0)
208
+
209
+ return out
210
+
211
+ def merge_embeddings(x, tiles): # TODO: this needs so much testing that I don't even
212
+ chunk_size = tiles*tiles
213
+ x = x.split(chunk_size)
214
+
215
+ out = []
216
+ for embeds in x:
217
+ num_tiles = embeds.shape[0]
218
+ grid_size = int(num_tiles ** 0.5)
219
+ tile_size = int(embeds.shape[1] ** 0.5)
220
+ reshaped = embeds.reshape(grid_size, grid_size, tile_size, tile_size)
221
+
222
+ # Merge the tiles
223
+ merged = torch.cat([torch.cat([reshaped[i, j] for j in range(grid_size)], dim=1)
224
+ for i in range(grid_size)], dim=0)
225
+
226
+ merged = merged.unsqueeze(0) # Shape: [1, grid_size*tile_size, grid_size*tile_size]
227
+
228
+ # Pool to original size
229
+ pooled = torch.nn.functional.adaptive_avg_pool2d(merged, (tile_size, tile_size)) # pool to [1, tile_size, tile_size]
230
+ pooled = pooled.flatten(1) # flatten to [1, tile_size^2]
231
+ out.append(pooled)
232
+ out = torch.cat(out, dim=0)
233
+
234
+ return out
235
+
236
+ def encode_image_masked(clip_vision, image, mask=None, batch_size=0, tiles=1, ratio=1.0, clipvision_size=224):
237
+ # full image embeds
238
+ embeds = encode_image_masked_(clip_vision, image, mask, batch_size, clipvision_size=clipvision_size)
239
+ tiles = min(tiles, 16)
240
+
241
+ if tiles > 1:
242
+ # split in tiles
243
+ image_split = split_tiles(image, tiles)
244
+
245
+ # get the embeds for each tile
246
+ embeds_split = Output()
247
+ for i in image_split:
248
+ encoded = encode_image_masked_(clip_vision, i, mask, batch_size, clipvision_size=clipvision_size)
249
+ if not hasattr(embeds_split, "image_embeds"):
250
+ #embeds_split["last_hidden_state"] = encoded["last_hidden_state"]
251
+ embeds_split["image_embeds"] = encoded["image_embeds"]
252
+ embeds_split["penultimate_hidden_states"] = encoded["penultimate_hidden_states"]
253
+ else:
254
+ #embeds_split["last_hidden_state"] = torch.cat((embeds_split["last_hidden_state"], encoded["last_hidden_state"]), dim=0)
255
+ embeds_split["image_embeds"] = torch.cat((embeds_split["image_embeds"], encoded["image_embeds"]), dim=0)
256
+ embeds_split["penultimate_hidden_states"] = torch.cat((embeds_split["penultimate_hidden_states"], encoded["penultimate_hidden_states"]), dim=0)
257
+
258
+ #embeds_split['last_hidden_state'] = merge_hiddenstates(embeds_split['last_hidden_state'])
259
+ embeds_split["image_embeds"] = merge_embeddings(embeds_split["image_embeds"], tiles)
260
+ embeds_split["penultimate_hidden_states"] = merge_hiddenstates(embeds_split["penultimate_hidden_states"], tiles)
261
+
262
+ #embeds['last_hidden_state'] = torch.cat([embeds_split['last_hidden_state'], embeds['last_hidden_state']])
263
+ if embeds['image_embeds'].shape[0] > 1: # if we have more than one image we need to average the embeddings for consistency
264
+ embeds['image_embeds'] = embeds['image_embeds']*ratio + embeds_split['image_embeds']*(1-ratio)
265
+ embeds['penultimate_hidden_states'] = embeds['penultimate_hidden_states']*ratio + embeds_split['penultimate_hidden_states']*(1-ratio)
266
+ #embeds['image_embeds'] = (embeds['image_embeds']*ratio + embeds_split['image_embeds']) / 2
267
+ #embeds['penultimate_hidden_states'] = (embeds['penultimate_hidden_states']*ratio + embeds_split['penultimate_hidden_states']) / 2
268
+ else: # otherwise we can concatenate them, they can be averaged later
269
+ embeds['image_embeds'] = torch.cat([embeds['image_embeds']*ratio, embeds_split['image_embeds']])
270
+ embeds['penultimate_hidden_states'] = torch.cat([embeds['penultimate_hidden_states']*ratio, embeds_split['penultimate_hidden_states']])
271
+
272
+ #del embeds_split
273
+
274
+ return embeds
275
+
276
+ def encode_image_masked_(clip_vision, image, mask=None, batch_size=0, clipvision_size=224):
277
+ model_management.load_model_gpu(clip_vision.patcher)
278
+ outputs = Output()
279
+
280
+ if batch_size == 0:
281
+ batch_size = image.shape[0]
282
+ elif batch_size > image.shape[0]:
283
+ batch_size = image.shape[0]
284
+
285
+ image_batch = torch.split(image, batch_size, dim=0)
286
+
287
+ for img in image_batch:
288
+ img = img.to(clip_vision.load_device)
289
+ pixel_values = clip_preprocess(img, size=clipvision_size).float()
290
+
291
+ # TODO: support for multiple masks
292
+ if mask is not None:
293
+ pixel_values = pixel_values * mask.to(clip_vision.load_device)
294
+
295
+ out = clip_vision.model(pixel_values=pixel_values, intermediate_output=-2)
296
+
297
+ if not hasattr(outputs, "last_hidden_state"):
298
+ outputs["last_hidden_state"] = out[0].to(model_management.intermediate_device())
299
+ outputs["image_embeds"] = out[2].to(model_management.intermediate_device())
300
+ outputs["penultimate_hidden_states"] = out[1].to(model_management.intermediate_device())
301
+ else:
302
+ outputs["last_hidden_state"] = torch.cat((outputs["last_hidden_state"], out[0].to(model_management.intermediate_device())), dim=0)
303
+ outputs["image_embeds"] = torch.cat((outputs["image_embeds"], out[2].to(model_management.intermediate_device())), dim=0)
304
+ outputs["penultimate_hidden_states"] = torch.cat((outputs["penultimate_hidden_states"], out[1].to(model_management.intermediate_device())), dim=0)
305
+
306
+ del img, pixel_values, out
307
+ torch.cuda.empty_cache()
308
+
309
+ return outputs
310
+
311
+ def tensor_to_size(source, dest_size):
312
+ if isinstance(dest_size, torch.Tensor):
313
+ dest_size = dest_size.shape[0]
314
+ source_size = source.shape[0]
315
+
316
+ if source_size < dest_size:
317
+ shape = [dest_size - source_size] + [1]*(source.dim()-1)
318
+ source = torch.cat((source, source[-1:].repeat(shape)), dim=0)
319
+ elif source_size > dest_size:
320
+ source = source[:dest_size]
321
+
322
+ return source
323
+
324
+ def min_(tensor_list):
325
+ # return the element-wise min of the tensor list.
326
+ x = torch.stack(tensor_list)
327
+ mn = x.min(axis=0)[0]
328
+ return torch.clamp(mn, min=0)
329
+
330
+ def max_(tensor_list):
331
+ # return the element-wise max of the tensor list.
332
+ x = torch.stack(tensor_list)
333
+ mx = x.max(axis=0)[0]
334
+ return torch.clamp(mx, max=1)
335
+
336
+ # From https://github.com/Jamy-L/Pytorch-Contrast-Adaptive-Sharpening/
337
+ def contrast_adaptive_sharpening(image, amount):
338
+ img = T.functional.pad(image, (1, 1, 1, 1)).cpu()
339
+
340
+ a = img[..., :-2, :-2]
341
+ b = img[..., :-2, 1:-1]
342
+ c = img[..., :-2, 2:]
343
+ d = img[..., 1:-1, :-2]
344
+ e = img[..., 1:-1, 1:-1]
345
+ f = img[..., 1:-1, 2:]
346
+ g = img[..., 2:, :-2]
347
+ h = img[..., 2:, 1:-1]
348
+ i = img[..., 2:, 2:]
349
+
350
+ # Computing contrast
351
+ cross = (b, d, e, f, h)
352
+ mn = min_(cross)
353
+ mx = max_(cross)
354
+
355
+ diag = (a, c, g, i)
356
+ mn2 = min_(diag)
357
+ mx2 = max_(diag)
358
+ mx = mx + mx2
359
+ mn = mn + mn2
360
+
361
+ # Computing local weight
362
+ inv_mx = torch.reciprocal(mx)
363
+ amp = inv_mx * torch.minimum(mn, (2 - mx))
364
+
365
+ # scaling
366
+ amp = torch.sqrt(amp)
367
+ w = - amp * (amount * (1/5 - 1/8) + 1/8)
368
+ div = torch.reciprocal(1 + 4*w)
369
+
370
+ output = ((b + d + f + h)*w + e) * div
371
+ output = torch.nan_to_num(output)
372
+ output = output.clamp(0, 1)
373
+
374
+ return output
375
+
376
+ def tensor_to_image(tensor):
377
+ image = tensor.mul(255).clamp(0, 255).byte().cpu()
378
+ image = image[..., [2, 1, 0]].numpy()
379
+ return image
380
+
381
+ def image_to_tensor(image):
382
+ tensor = torch.clamp(torch.from_numpy(image).float() / 255., 0, 1)
383
+ tensor = tensor[..., [2, 1, 0]]
384
+ return tensor
ComfyUI/custom_nodes/comfyui_segment_anything/.gitignore ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
ComfyUI/custom_nodes/comfyui_segment_anything/LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
ComfyUI/custom_nodes/comfyui_segment_anything/README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ComfyUI Segment Anything
2
+
3
+ This project is a ComfyUI version of
4
+ `https://github.com/continue-revolution/sd-webui-segment-anything`. At present, only the most core functionalities have been implemented. I would like to express my gratitude to [continue-revolution](https://github.com/continue-revolution) for their preceding work on which this is based.
5
+
6
+ ![example](./docs/images/example.jpg)
7
+
8
+ I have ensured consistency with `sd-webui-segment-anything` in terms of output when given the same input.
9
+
10
+ ## Requirements
11
+
12
+ Please ensure that you have installed Python dependencies using the following command:
13
+ ```
14
+ pip3 install -r requirements.txt
15
+ ```
16
+
17
+ ## Models
18
+
19
+ The models will be automatically downloaded when used. You can also manually download them according to the table below. If the automatic download is slow, you can set the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to use a proxy.
20
+
21
+ ### bert-base-uncased
22
+
23
+ You can download the model from https://huggingface.co/bert-base-uncased/tree/main into the `models/bert-base-uncased` folder located in the root directory of ComfyUI, like this:
24
+
25
+ ```
26
+ ComfyUI
27
+ models
28
+ bert-base-uncased
29
+ config.json
30
+ model.safetensors
31
+ tokenizer_config.json
32
+ tokenizer.json
33
+ vocab.txt
34
+ ```
35
+
36
+ You can also skip this step. During the inference process, `bert-base-uncased` will be automatically downloaded through the `transformers` library, and its directory is typically `~/.cache/huggingface/hub/models--bert-base-uncased`.
37
+
38
+ ### GroundingDino
39
+
40
+ Please directly download the models and configuration files to the `models/grounding-dino` directory under the ComfyUI root directory, without modifying the file names.
41
+
42
+ | name | size | config file | model file |
43
+ |-|-|-|-|
44
+ | GroundingDINO_SwinT_OGC | 694MB | [download link](https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/GroundingDINO_SwinT_OGC.cfg.py) | [download link](https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swint_ogc.pth) |
45
+ | GroundingDINO_SwinB | 938MB | [download link](https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/GroundingDINO_SwinB.cfg.py) | [download link](https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swinb_cogcoor.pth) |
46
+
47
+ ### SAM
48
+
49
+ Please directly download the model files to the `models/sams` directory under the ComfyUI root directory, without modifying the file names.
50
+
51
+ | name | size | model file |
52
+ |-|-|-|
53
+ | sam_vit_h | 2.56GB |[download link](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth) |
54
+ | sam_vit_l | 1.25GB |[download link](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth) |
55
+ | sam_vit_b | 375MB |[download link](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth) |
56
+ | sam_hq_vit_h | 2.57GB |[download link](https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_h.pth) |
57
+ | sam_hq_vit_l | 1.25GB |[download link](https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_l.pth) |
58
+ | sam_hq_vit_b | 379MB |[download link](https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_b.pth) |
59
+ | mobile_sam | 39MB |[download link](https://github.com/ChaoningZhang/MobileSAM/blob/master/weights/mobile_sam.pt) |
60
+
61
+
62
+ ## Contribution
63
+
64
+ Thank you for considering to help out with the source code! Welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!
65
+
66
+ If you'd like to contribute to this project, please fork, fix, commit and send a pull request for me to review and merge into the main code base.
ComfyUI/custom_nodes/comfyui_segment_anything/__init__.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .node import *
2
+ from .install import *
3
+
4
+ NODE_CLASS_MAPPINGS = {
5
+ 'SAMModelLoader (segment anything)': SAMModelLoader,
6
+ 'GroundingDinoModelLoader (segment anything)': GroundingDinoModelLoader,
7
+ 'GroundingDinoSAMSegment (segment anything)': GroundingDinoSAMSegment,
8
+ 'InvertMask (segment anything)': InvertMask,
9
+ "IsMaskEmpty": IsMaskEmptyNode,
10
+ }
11
+
12
+ __all__ = ['NODE_CLASS_MAPPINGS']
13
+
14
+
ComfyUI/custom_nodes/comfyui_segment_anything/docs/images/example.jpg ADDED
ComfyUI/custom_nodes/comfyui_segment_anything/install.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import os.path
3
+ import subprocess
4
+
5
+ custom_nodes_path = os.path.dirname(os.path.abspath(__file__))
6
+
7
+ def build_pip_install_cmds(args):
8
+ if "python_embeded" in sys.executable or "python_embedded" in sys.executable:
9
+ return [sys.executable, '-s', '-m', 'pip', 'install'] + args
10
+ else:
11
+ return [sys.executable, '-m', 'pip', 'install'] + args
12
+
13
+ def ensure_package():
14
+ cmds = build_pip_install_cmds(['-r', 'requirements.txt'])
15
+ subprocess.run(cmds, cwd=custom_nodes_path)
16
+
17
+ if __name__ == "__main__":
18
+ ensure_package()
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/datasets/__init__.py ADDED
File without changes
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/datasets/transforms.py ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
2
+ """
3
+ Transforms and data augmentation for both image + bbox.
4
+ """
5
+ import os
6
+ import random
7
+
8
+ import PIL
9
+ import torch
10
+ import torchvision.transforms as T
11
+ import torchvision.transforms.functional as F
12
+
13
+ from local_groundingdino.util.box_ops import box_xyxy_to_cxcywh
14
+ from local_groundingdino.util.misc import interpolate
15
+
16
+
17
+ def crop(image, target, region):
18
+ cropped_image = F.crop(image, *region)
19
+
20
+ target = target.copy()
21
+ i, j, h, w = region
22
+
23
+ # should we do something wrt the original size?
24
+ target["size"] = torch.tensor([h, w])
25
+
26
+ fields = ["labels", "area", "iscrowd", "positive_map"]
27
+
28
+ if "boxes" in target:
29
+ boxes = target["boxes"]
30
+ max_size = torch.as_tensor([w, h], dtype=torch.float32)
31
+ cropped_boxes = boxes - torch.as_tensor([j, i, j, i])
32
+ cropped_boxes = torch.min(cropped_boxes.reshape(-1, 2, 2), max_size)
33
+ cropped_boxes = cropped_boxes.clamp(min=0)
34
+ area = (cropped_boxes[:, 1, :] - cropped_boxes[:, 0, :]).prod(dim=1)
35
+ target["boxes"] = cropped_boxes.reshape(-1, 4)
36
+ target["area"] = area
37
+ fields.append("boxes")
38
+
39
+ if "masks" in target:
40
+ # FIXME should we update the area here if there are no boxes?
41
+ target["masks"] = target["masks"][:, i : i + h, j : j + w]
42
+ fields.append("masks")
43
+
44
+ # remove elements for which the boxes or masks that have zero area
45
+ if "boxes" in target or "masks" in target:
46
+ # favor boxes selection when defining which elements to keep
47
+ # this is compatible with previous implementation
48
+ if "boxes" in target:
49
+ cropped_boxes = target["boxes"].reshape(-1, 2, 2)
50
+ keep = torch.all(cropped_boxes[:, 1, :] > cropped_boxes[:, 0, :], dim=1)
51
+ else:
52
+ keep = target["masks"].flatten(1).any(1)
53
+
54
+ for field in fields:
55
+ if field in target:
56
+ target[field] = target[field][keep]
57
+
58
+ if os.environ.get("IPDB_SHILONG_DEBUG", None) == "INFO":
59
+ # for debug and visualization only.
60
+ if "strings_positive" in target:
61
+ target["strings_positive"] = [
62
+ _i for _i, _j in zip(target["strings_positive"], keep) if _j
63
+ ]
64
+
65
+ return cropped_image, target
66
+
67
+
68
+ def hflip(image, target):
69
+ flipped_image = F.hflip(image)
70
+
71
+ w, h = image.size
72
+
73
+ target = target.copy()
74
+ if "boxes" in target:
75
+ boxes = target["boxes"]
76
+ boxes = boxes[:, [2, 1, 0, 3]] * torch.as_tensor([-1, 1, -1, 1]) + torch.as_tensor(
77
+ [w, 0, w, 0]
78
+ )
79
+ target["boxes"] = boxes
80
+
81
+ if "masks" in target:
82
+ target["masks"] = target["masks"].flip(-1)
83
+
84
+ return flipped_image, target
85
+
86
+
87
+ def resize(image, target, size, max_size=None):
88
+ # size can be min_size (scalar) or (w, h) tuple
89
+
90
+ def get_size_with_aspect_ratio(image_size, size, max_size=None):
91
+ w, h = image_size
92
+ if max_size is not None:
93
+ min_original_size = float(min((w, h)))
94
+ max_original_size = float(max((w, h)))
95
+ if max_original_size / min_original_size * size > max_size:
96
+ size = int(round(max_size * min_original_size / max_original_size))
97
+
98
+ if (w <= h and w == size) or (h <= w and h == size):
99
+ return (h, w)
100
+
101
+ if w < h:
102
+ ow = size
103
+ oh = int(size * h / w)
104
+ else:
105
+ oh = size
106
+ ow = int(size * w / h)
107
+
108
+ return (oh, ow)
109
+
110
+ def get_size(image_size, size, max_size=None):
111
+ if isinstance(size, (list, tuple)):
112
+ return size[::-1]
113
+ else:
114
+ return get_size_with_aspect_ratio(image_size, size, max_size)
115
+
116
+ size = get_size(image.size, size, max_size)
117
+ rescaled_image = F.resize(image, size)
118
+
119
+ if target is None:
120
+ return rescaled_image, None
121
+
122
+ ratios = tuple(float(s) / float(s_orig) for s, s_orig in zip(rescaled_image.size, image.size))
123
+ ratio_width, ratio_height = ratios
124
+
125
+ target = target.copy()
126
+ if "boxes" in target:
127
+ boxes = target["boxes"]
128
+ scaled_boxes = boxes * torch.as_tensor(
129
+ [ratio_width, ratio_height, ratio_width, ratio_height]
130
+ )
131
+ target["boxes"] = scaled_boxes
132
+
133
+ if "area" in target:
134
+ area = target["area"]
135
+ scaled_area = area * (ratio_width * ratio_height)
136
+ target["area"] = scaled_area
137
+
138
+ h, w = size
139
+ target["size"] = torch.tensor([h, w])
140
+
141
+ if "masks" in target:
142
+ target["masks"] = (
143
+ interpolate(target["masks"][:, None].float(), size, mode="nearest")[:, 0] > 0.5
144
+ )
145
+
146
+ return rescaled_image, target
147
+
148
+
149
+ def pad(image, target, padding):
150
+ # assumes that we only pad on the bottom right corners
151
+ padded_image = F.pad(image, (0, 0, padding[0], padding[1]))
152
+ if target is None:
153
+ return padded_image, None
154
+ target = target.copy()
155
+ # should we do something wrt the original size?
156
+ target["size"] = torch.tensor(padded_image.size[::-1])
157
+ if "masks" in target:
158
+ target["masks"] = torch.nn.functional.pad(target["masks"], (0, padding[0], 0, padding[1]))
159
+ return padded_image, target
160
+
161
+
162
+ class ResizeDebug(object):
163
+ def __init__(self, size):
164
+ self.size = size
165
+
166
+ def __call__(self, img, target):
167
+ return resize(img, target, self.size)
168
+
169
+
170
+ class RandomCrop(object):
171
+ def __init__(self, size):
172
+ self.size = size
173
+
174
+ def __call__(self, img, target):
175
+ region = T.RandomCrop.get_params(img, self.size)
176
+ return crop(img, target, region)
177
+
178
+
179
+ class RandomSizeCrop(object):
180
+ def __init__(self, min_size: int, max_size: int, respect_boxes: bool = False):
181
+ # respect_boxes: True to keep all boxes
182
+ # False to tolerence box filter
183
+ self.min_size = min_size
184
+ self.max_size = max_size
185
+ self.respect_boxes = respect_boxes
186
+
187
+ def __call__(self, img: PIL.Image.Image, target: dict):
188
+ init_boxes = len(target["boxes"])
189
+ max_patience = 10
190
+ for i in range(max_patience):
191
+ w = random.randint(self.min_size, min(img.width, self.max_size))
192
+ h = random.randint(self.min_size, min(img.height, self.max_size))
193
+ region = T.RandomCrop.get_params(img, [h, w])
194
+ result_img, result_target = crop(img, target, region)
195
+ if (
196
+ not self.respect_boxes
197
+ or len(result_target["boxes"]) == init_boxes
198
+ or i == max_patience - 1
199
+ ):
200
+ return result_img, result_target
201
+ return result_img, result_target
202
+
203
+
204
+ class CenterCrop(object):
205
+ def __init__(self, size):
206
+ self.size = size
207
+
208
+ def __call__(self, img, target):
209
+ image_width, image_height = img.size
210
+ crop_height, crop_width = self.size
211
+ crop_top = int(round((image_height - crop_height) / 2.0))
212
+ crop_left = int(round((image_width - crop_width) / 2.0))
213
+ return crop(img, target, (crop_top, crop_left, crop_height, crop_width))
214
+
215
+
216
+ class RandomHorizontalFlip(object):
217
+ def __init__(self, p=0.5):
218
+ self.p = p
219
+
220
+ def __call__(self, img, target):
221
+ if random.random() < self.p:
222
+ return hflip(img, target)
223
+ return img, target
224
+
225
+
226
+ class RandomResize(object):
227
+ def __init__(self, sizes, max_size=None):
228
+ assert isinstance(sizes, (list, tuple))
229
+ self.sizes = sizes
230
+ self.max_size = max_size
231
+
232
+ def __call__(self, img, target=None):
233
+ size = random.choice(self.sizes)
234
+ return resize(img, target, size, self.max_size)
235
+
236
+
237
+ class RandomPad(object):
238
+ def __init__(self, max_pad):
239
+ self.max_pad = max_pad
240
+
241
+ def __call__(self, img, target):
242
+ pad_x = random.randint(0, self.max_pad)
243
+ pad_y = random.randint(0, self.max_pad)
244
+ return pad(img, target, (pad_x, pad_y))
245
+
246
+
247
+ class RandomSelect(object):
248
+ """
249
+ Randomly selects between transforms1 and transforms2,
250
+ with probability p for transforms1 and (1 - p) for transforms2
251
+ """
252
+
253
+ def __init__(self, transforms1, transforms2, p=0.5):
254
+ self.transforms1 = transforms1
255
+ self.transforms2 = transforms2
256
+ self.p = p
257
+
258
+ def __call__(self, img, target):
259
+ if random.random() < self.p:
260
+ return self.transforms1(img, target)
261
+ return self.transforms2(img, target)
262
+
263
+
264
+ class ToTensor(object):
265
+ def __call__(self, img, target):
266
+ return F.to_tensor(img), target
267
+
268
+
269
+ class RandomErasing(object):
270
+ def __init__(self, *args, **kwargs):
271
+ self.eraser = T.RandomErasing(*args, **kwargs)
272
+
273
+ def __call__(self, img, target):
274
+ return self.eraser(img), target
275
+
276
+
277
+ class Normalize(object):
278
+ def __init__(self, mean, std):
279
+ self.mean = mean
280
+ self.std = std
281
+
282
+ def __call__(self, image, target=None):
283
+ image = F.normalize(image, mean=self.mean, std=self.std)
284
+ if target is None:
285
+ return image, None
286
+ target = target.copy()
287
+ h, w = image.shape[-2:]
288
+ if "boxes" in target:
289
+ boxes = target["boxes"]
290
+ boxes = box_xyxy_to_cxcywh(boxes)
291
+ boxes = boxes / torch.tensor([w, h, w, h], dtype=torch.float32)
292
+ target["boxes"] = boxes
293
+ return image, target
294
+
295
+
296
+ class Compose(object):
297
+ def __init__(self, transforms):
298
+ self.transforms = transforms
299
+
300
+ def __call__(self, image, target):
301
+ for t in self.transforms:
302
+ image, target = t(image, target)
303
+ return image, target
304
+
305
+ def __repr__(self):
306
+ format_string = self.__class__.__name__ + "("
307
+ for t in self.transforms:
308
+ format_string += "\n"
309
+ format_string += " {0}".format(t)
310
+ format_string += "\n)"
311
+ return format_string
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/__init__.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+ # Conditional DETR
8
+ # Copyright (c) 2021 Microsoft. All Rights Reserved.
9
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
10
+ # ------------------------------------------------------------------------
11
+ # Copied from DETR (https://github.com/facebookresearch/detr)
12
+ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
13
+ # ------------------------------------------------------------------------
14
+
15
+ from .groundingdino import build_groundingdino
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from .backbone import build_backbone
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/backbone.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+ # Conditional DETR
8
+ # Copyright (c) 2021 Microsoft. All Rights Reserved.
9
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
10
+ # ------------------------------------------------------------------------
11
+ # Copied from DETR (https://github.com/facebookresearch/detr)
12
+ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
13
+ # ------------------------------------------------------------------------
14
+
15
+ """
16
+ Backbone modules.
17
+ """
18
+
19
+ from typing import Dict, List
20
+
21
+ import torch
22
+ import torch.nn.functional as F
23
+ import torchvision
24
+ from torch import nn
25
+ from torchvision.models._utils import IntermediateLayerGetter
26
+
27
+ from local_groundingdino.util.misc import NestedTensor, is_main_process
28
+
29
+ from .position_encoding import build_position_encoding
30
+ from .swin_transformer import build_swin_transformer
31
+
32
+
33
+ class FrozenBatchNorm2d(torch.nn.Module):
34
+ """
35
+ BatchNorm2d where the batch statistics and the affine parameters are fixed.
36
+
37
+ Copy-paste from torchvision.misc.ops with added eps before rqsrt,
38
+ without which any other models than torchvision.models.resnet[18,34,50,101]
39
+ produce nans.
40
+ """
41
+
42
+ def __init__(self, n):
43
+ super(FrozenBatchNorm2d, self).__init__()
44
+ self.register_buffer("weight", torch.ones(n))
45
+ self.register_buffer("bias", torch.zeros(n))
46
+ self.register_buffer("running_mean", torch.zeros(n))
47
+ self.register_buffer("running_var", torch.ones(n))
48
+
49
+ def _load_from_state_dict(
50
+ self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs
51
+ ):
52
+ num_batches_tracked_key = prefix + "num_batches_tracked"
53
+ if num_batches_tracked_key in state_dict:
54
+ del state_dict[num_batches_tracked_key]
55
+
56
+ super(FrozenBatchNorm2d, self)._load_from_state_dict(
57
+ state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs
58
+ )
59
+
60
+ def forward(self, x):
61
+ # move reshapes to the beginning
62
+ # to make it fuser-friendly
63
+ w = self.weight.reshape(1, -1, 1, 1)
64
+ b = self.bias.reshape(1, -1, 1, 1)
65
+ rv = self.running_var.reshape(1, -1, 1, 1)
66
+ rm = self.running_mean.reshape(1, -1, 1, 1)
67
+ eps = 1e-5
68
+ scale = w * (rv + eps).rsqrt()
69
+ bias = b - rm * scale
70
+ return x * scale + bias
71
+
72
+
73
+ class BackboneBase(nn.Module):
74
+ def __init__(
75
+ self,
76
+ backbone: nn.Module,
77
+ train_backbone: bool,
78
+ num_channels: int,
79
+ return_interm_indices: list,
80
+ ):
81
+ super().__init__()
82
+ for name, parameter in backbone.named_parameters():
83
+ if (
84
+ not train_backbone
85
+ or "layer2" not in name
86
+ and "layer3" not in name
87
+ and "layer4" not in name
88
+ ):
89
+ parameter.requires_grad_(False)
90
+
91
+ return_layers = {}
92
+ for idx, layer_index in enumerate(return_interm_indices):
93
+ return_layers.update(
94
+ {"layer{}".format(5 - len(return_interm_indices) + idx): "{}".format(layer_index)}
95
+ )
96
+
97
+ # if len:
98
+ # if use_stage1_feature:
99
+ # return_layers = {"layer1": "0", "layer2": "1", "layer3": "2", "layer4": "3"}
100
+ # else:
101
+ # return_layers = {"layer2": "0", "layer3": "1", "layer4": "2"}
102
+ # else:
103
+ # return_layers = {'layer4': "0"}
104
+ self.body = IntermediateLayerGetter(backbone, return_layers=return_layers)
105
+ self.num_channels = num_channels
106
+
107
+ def forward(self, tensor_list: NestedTensor):
108
+ xs = self.body(tensor_list.tensors)
109
+ out: Dict[str, NestedTensor] = {}
110
+ for name, x in xs.items():
111
+ m = tensor_list.mask
112
+ assert m is not None
113
+ mask = F.interpolate(m[None].float(), size=x.shape[-2:]).to(torch.bool)[0]
114
+ out[name] = NestedTensor(x, mask)
115
+ # import ipdb; ipdb.set_trace()
116
+ return out
117
+
118
+
119
+ class Backbone(BackboneBase):
120
+ """ResNet backbone with frozen BatchNorm."""
121
+
122
+ def __init__(
123
+ self,
124
+ name: str,
125
+ train_backbone: bool,
126
+ dilation: bool,
127
+ return_interm_indices: list,
128
+ batch_norm=FrozenBatchNorm2d,
129
+ ):
130
+ if name in ["resnet18", "resnet34", "resnet50", "resnet101"]:
131
+ backbone = getattr(torchvision.models, name)(
132
+ replace_stride_with_dilation=[False, False, dilation],
133
+ pretrained=is_main_process(),
134
+ norm_layer=batch_norm,
135
+ )
136
+ else:
137
+ raise NotImplementedError("Why you can get here with name {}".format(name))
138
+ # num_channels = 512 if name in ('resnet18', 'resnet34') else 2048
139
+ assert name not in ("resnet18", "resnet34"), "Only resnet50 and resnet101 are available."
140
+ assert return_interm_indices in [[0, 1, 2, 3], [1, 2, 3], [3]]
141
+ num_channels_all = [256, 512, 1024, 2048]
142
+ num_channels = num_channels_all[4 - len(return_interm_indices) :]
143
+ super().__init__(backbone, train_backbone, num_channels, return_interm_indices)
144
+
145
+
146
+ class Joiner(nn.Sequential):
147
+ def __init__(self, backbone, position_embedding):
148
+ super().__init__(backbone, position_embedding)
149
+
150
+ def forward(self, tensor_list: NestedTensor):
151
+ xs = self[0](tensor_list)
152
+ out: List[NestedTensor] = []
153
+ pos = []
154
+ for name, x in xs.items():
155
+ out.append(x)
156
+ # position encoding
157
+ pos.append(self[1](x).to(x.tensors.dtype))
158
+
159
+ return out, pos
160
+
161
+
162
+ def build_backbone(args):
163
+ """
164
+ Useful args:
165
+ - backbone: backbone name
166
+ - lr_backbone:
167
+ - dilation
168
+ - return_interm_indices: available: [0,1,2,3], [1,2,3], [3]
169
+ - backbone_freeze_keywords:
170
+ - use_checkpoint: for swin only for now
171
+
172
+ """
173
+ position_embedding = build_position_encoding(args)
174
+ train_backbone = True
175
+ if not train_backbone:
176
+ raise ValueError("Please set lr_backbone > 0")
177
+ return_interm_indices = args.return_interm_indices
178
+ assert return_interm_indices in [[0, 1, 2, 3], [1, 2, 3], [3]]
179
+ args.backbone_freeze_keywords
180
+ use_checkpoint = getattr(args, "use_checkpoint", False)
181
+
182
+ if args.backbone in ["resnet50", "resnet101"]:
183
+ backbone = Backbone(
184
+ args.backbone,
185
+ train_backbone,
186
+ args.dilation,
187
+ return_interm_indices,
188
+ batch_norm=FrozenBatchNorm2d,
189
+ )
190
+ bb_num_channels = backbone.num_channels
191
+ elif args.backbone in [
192
+ "swin_T_224_1k",
193
+ "swin_B_224_22k",
194
+ "swin_B_384_22k",
195
+ "swin_L_224_22k",
196
+ "swin_L_384_22k",
197
+ ]:
198
+ pretrain_img_size = int(args.backbone.split("_")[-2])
199
+ backbone = build_swin_transformer(
200
+ args.backbone,
201
+ pretrain_img_size=pretrain_img_size,
202
+ out_indices=tuple(return_interm_indices),
203
+ dilation=False,
204
+ use_checkpoint=use_checkpoint,
205
+ )
206
+
207
+ bb_num_channels = backbone.num_features[4 - len(return_interm_indices) :]
208
+ else:
209
+ raise NotImplementedError("Unknown backbone {}".format(args.backbone))
210
+
211
+ assert len(bb_num_channels) == len(
212
+ return_interm_indices
213
+ ), f"len(bb_num_channels) {len(bb_num_channels)} != len(return_interm_indices) {len(return_interm_indices)}"
214
+
215
+ model = Joiner(backbone, position_embedding)
216
+ model.num_channels = bb_num_channels
217
+ assert isinstance(
218
+ bb_num_channels, List
219
+ ), "bb_num_channels is expected to be a List but {}".format(type(bb_num_channels))
220
+ # import ipdb; ipdb.set_trace()
221
+ return model
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/position_encoding.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+ # DINO
8
+ # Copyright (c) 2022 IDEA. All Rights Reserved.
9
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
10
+ # ------------------------------------------------------------------------
11
+ # Conditional DETR
12
+ # Copyright (c) 2021 Microsoft. All Rights Reserved.
13
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
14
+ # ------------------------------------------------------------------------
15
+ # Copied from DETR (https://github.com/facebookresearch/detr)
16
+ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
17
+ # ------------------------------------------------------------------------
18
+
19
+ """
20
+ Various positional encodings for the transformer.
21
+ """
22
+ import math
23
+
24
+ import torch
25
+ from torch import nn
26
+
27
+ from local_groundingdino.util.misc import NestedTensor
28
+
29
+
30
+ class PositionEmbeddingSine(nn.Module):
31
+ """
32
+ This is a more standard version of the position embedding, very similar to the one
33
+ used by the Attention is all you need paper, generalized to work on images.
34
+ """
35
+
36
+ def __init__(self, num_pos_feats=64, temperature=10000, normalize=False, scale=None):
37
+ super().__init__()
38
+ self.num_pos_feats = num_pos_feats
39
+ self.temperature = temperature
40
+ self.normalize = normalize
41
+ if scale is not None and normalize is False:
42
+ raise ValueError("normalize should be True if scale is passed")
43
+ if scale is None:
44
+ scale = 2 * math.pi
45
+ self.scale = scale
46
+
47
+ def forward(self, tensor_list: NestedTensor):
48
+ x = tensor_list.tensors
49
+ mask = tensor_list.mask
50
+ assert mask is not None
51
+ not_mask = ~mask
52
+ y_embed = not_mask.cumsum(1, dtype=torch.float32)
53
+ x_embed = not_mask.cumsum(2, dtype=torch.float32)
54
+ if self.normalize:
55
+ eps = 1e-6
56
+ # if os.environ.get("SHILONG_AMP", None) == '1':
57
+ # eps = 1e-4
58
+ # else:
59
+ # eps = 1e-6
60
+ y_embed = y_embed / (y_embed[:, -1:, :] + eps) * self.scale
61
+ x_embed = x_embed / (x_embed[:, :, -1:] + eps) * self.scale
62
+
63
+ dim_t = torch.arange(self.num_pos_feats, dtype=torch.float32, device=x.device)
64
+ dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
65
+
66
+ pos_x = x_embed[:, :, :, None] / dim_t
67
+ pos_y = y_embed[:, :, :, None] / dim_t
68
+ pos_x = torch.stack(
69
+ (pos_x[:, :, :, 0::2].sin(), pos_x[:, :, :, 1::2].cos()), dim=4
70
+ ).flatten(3)
71
+ pos_y = torch.stack(
72
+ (pos_y[:, :, :, 0::2].sin(), pos_y[:, :, :, 1::2].cos()), dim=4
73
+ ).flatten(3)
74
+ pos = torch.cat((pos_y, pos_x), dim=3).permute(0, 3, 1, 2)
75
+ return pos
76
+
77
+
78
+ class PositionEmbeddingSineHW(nn.Module):
79
+ """
80
+ This is a more standard version of the position embedding, very similar to the one
81
+ used by the Attention is all you need paper, generalized to work on images.
82
+ """
83
+
84
+ def __init__(
85
+ self, num_pos_feats=64, temperatureH=10000, temperatureW=10000, normalize=False, scale=None
86
+ ):
87
+ super().__init__()
88
+ self.num_pos_feats = num_pos_feats
89
+ self.temperatureH = temperatureH
90
+ self.temperatureW = temperatureW
91
+ self.normalize = normalize
92
+ if scale is not None and normalize is False:
93
+ raise ValueError("normalize should be True if scale is passed")
94
+ if scale is None:
95
+ scale = 2 * math.pi
96
+ self.scale = scale
97
+
98
+ def forward(self, tensor_list: NestedTensor):
99
+ x = tensor_list.tensors
100
+ mask = tensor_list.mask
101
+ assert mask is not None
102
+ not_mask = ~mask
103
+ y_embed = not_mask.cumsum(1, dtype=torch.float32)
104
+ x_embed = not_mask.cumsum(2, dtype=torch.float32)
105
+
106
+ # import ipdb; ipdb.set_trace()
107
+
108
+ if self.normalize:
109
+ eps = 1e-6
110
+ y_embed = y_embed / (y_embed[:, -1:, :] + eps) * self.scale
111
+ x_embed = x_embed / (x_embed[:, :, -1:] + eps) * self.scale
112
+
113
+ dim_tx = torch.arange(self.num_pos_feats, dtype=torch.float32, device=x.device)
114
+ dim_tx = self.temperatureW ** (2 * (torch.div(dim_tx, 2, rounding_mode='floor')) / self.num_pos_feats)
115
+ pos_x = x_embed[:, :, :, None] / dim_tx
116
+
117
+ dim_ty = torch.arange(self.num_pos_feats, dtype=torch.float32, device=x.device)
118
+ dim_ty = self.temperatureH ** (2 * (torch.div(dim_ty, 2, rounding_mode='floor')) / self.num_pos_feats)
119
+ pos_y = y_embed[:, :, :, None] / dim_ty
120
+
121
+ pos_x = torch.stack(
122
+ (pos_x[:, :, :, 0::2].sin(), pos_x[:, :, :, 1::2].cos()), dim=4
123
+ ).flatten(3)
124
+ pos_y = torch.stack(
125
+ (pos_y[:, :, :, 0::2].sin(), pos_y[:, :, :, 1::2].cos()), dim=4
126
+ ).flatten(3)
127
+ pos = torch.cat((pos_y, pos_x), dim=3).permute(0, 3, 1, 2)
128
+
129
+ # import ipdb; ipdb.set_trace()
130
+
131
+ return pos
132
+
133
+
134
+ class PositionEmbeddingLearned(nn.Module):
135
+ """
136
+ Absolute pos embedding, learned.
137
+ """
138
+
139
+ def __init__(self, num_pos_feats=256):
140
+ super().__init__()
141
+ self.row_embed = nn.Embedding(50, num_pos_feats)
142
+ self.col_embed = nn.Embedding(50, num_pos_feats)
143
+ self.reset_parameters()
144
+
145
+ def reset_parameters(self):
146
+ nn.init.uniform_(self.row_embed.weight)
147
+ nn.init.uniform_(self.col_embed.weight)
148
+
149
+ def forward(self, tensor_list: NestedTensor):
150
+ x = tensor_list.tensors
151
+ h, w = x.shape[-2:]
152
+ i = torch.arange(w, device=x.device)
153
+ j = torch.arange(h, device=x.device)
154
+ x_emb = self.col_embed(i)
155
+ y_emb = self.row_embed(j)
156
+ pos = (
157
+ torch.cat(
158
+ [
159
+ x_emb.unsqueeze(0).repeat(h, 1, 1),
160
+ y_emb.unsqueeze(1).repeat(1, w, 1),
161
+ ],
162
+ dim=-1,
163
+ )
164
+ .permute(2, 0, 1)
165
+ .unsqueeze(0)
166
+ .repeat(x.shape[0], 1, 1, 1)
167
+ )
168
+ return pos
169
+
170
+
171
+ def build_position_encoding(args):
172
+ N_steps = args.hidden_dim // 2
173
+ if args.position_embedding in ("v2", "sine"):
174
+ # TODO find a better way of exposing other arguments
175
+ position_embedding = PositionEmbeddingSineHW(
176
+ N_steps,
177
+ temperatureH=args.pe_temperatureH,
178
+ temperatureW=args.pe_temperatureW,
179
+ normalize=True,
180
+ )
181
+ elif args.position_embedding in ("v3", "learned"):
182
+ position_embedding = PositionEmbeddingLearned(N_steps)
183
+ else:
184
+ raise ValueError(f"not supported {args.position_embedding}")
185
+
186
+ return position_embedding
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/backbone/swin_transformer.py ADDED
@@ -0,0 +1,802 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+ # DINO
8
+ # Copyright (c) 2022 IDEA. All Rights Reserved.
9
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
10
+ # --------------------------------------------------------
11
+ # modified from https://github.com/SwinTransformer/Swin-Transformer-Object-Detection/blob/master/mmdet/models/backbones/swin_transformer.py
12
+ # --------------------------------------------------------
13
+
14
+ import numpy as np
15
+ import torch
16
+ import torch.nn as nn
17
+ import torch.nn.functional as F
18
+ import torch.utils.checkpoint as checkpoint
19
+ from timm.models.layers import DropPath, to_2tuple, trunc_normal_
20
+
21
+ from local_groundingdino.util.misc import NestedTensor
22
+
23
+
24
+ class Mlp(nn.Module):
25
+ """Multilayer perceptron."""
26
+
27
+ def __init__(
28
+ self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0
29
+ ):
30
+ super().__init__()
31
+ out_features = out_features or in_features
32
+ hidden_features = hidden_features or in_features
33
+ self.fc1 = nn.Linear(in_features, hidden_features)
34
+ self.act = act_layer()
35
+ self.fc2 = nn.Linear(hidden_features, out_features)
36
+ self.drop = nn.Dropout(drop)
37
+
38
+ def forward(self, x):
39
+ x = self.fc1(x)
40
+ x = self.act(x)
41
+ x = self.drop(x)
42
+ x = self.fc2(x)
43
+ x = self.drop(x)
44
+ return x
45
+
46
+
47
+ def window_partition(x, window_size):
48
+ """
49
+ Args:
50
+ x: (B, H, W, C)
51
+ window_size (int): window size
52
+ Returns:
53
+ windows: (num_windows*B, window_size, window_size, C)
54
+ """
55
+ B, H, W, C = x.shape
56
+ x = x.view(B, H // window_size, window_size, W // window_size, window_size, C)
57
+ windows = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(-1, window_size, window_size, C)
58
+ return windows
59
+
60
+
61
+ def window_reverse(windows, window_size, H, W):
62
+ """
63
+ Args:
64
+ windows: (num_windows*B, window_size, window_size, C)
65
+ window_size (int): Window size
66
+ H (int): Height of image
67
+ W (int): Width of image
68
+ Returns:
69
+ x: (B, H, W, C)
70
+ """
71
+ B = int(windows.shape[0] / (H * W / window_size / window_size))
72
+ x = windows.view(B, H // window_size, W // window_size, window_size, window_size, -1)
73
+ x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(B, H, W, -1)
74
+ return x
75
+
76
+
77
+ class WindowAttention(nn.Module):
78
+ """Window based multi-head self attention (W-MSA) module with relative position bias.
79
+ It supports both of shifted and non-shifted window.
80
+ Args:
81
+ dim (int): Number of input channels.
82
+ window_size (tuple[int]): The height and width of the window.
83
+ num_heads (int): Number of attention heads.
84
+ qkv_bias (bool, optional): If True, add a learnable bias to query, key, value. Default: True
85
+ qk_scale (float | None, optional): Override default qk scale of head_dim ** -0.5 if set
86
+ attn_drop (float, optional): Dropout ratio of attention weight. Default: 0.0
87
+ proj_drop (float, optional): Dropout ratio of output. Default: 0.0
88
+ """
89
+
90
+ def __init__(
91
+ self,
92
+ dim,
93
+ window_size,
94
+ num_heads,
95
+ qkv_bias=True,
96
+ qk_scale=None,
97
+ attn_drop=0.0,
98
+ proj_drop=0.0,
99
+ ):
100
+
101
+ super().__init__()
102
+ self.dim = dim
103
+ self.window_size = window_size # Wh, Ww
104
+ self.num_heads = num_heads
105
+ head_dim = dim // num_heads
106
+ self.scale = qk_scale or head_dim**-0.5
107
+
108
+ # define a parameter table of relative position bias
109
+ self.relative_position_bias_table = nn.Parameter(
110
+ torch.zeros((2 * window_size[0] - 1) * (2 * window_size[1] - 1), num_heads)
111
+ ) # 2*Wh-1 * 2*Ww-1, nH
112
+
113
+ # get pair-wise relative position index for each token inside the window
114
+ coords_h = torch.arange(self.window_size[0])
115
+ coords_w = torch.arange(self.window_size[1])
116
+ coords = torch.stack(torch.meshgrid([coords_h, coords_w])) # 2, Wh, Ww
117
+ coords_flatten = torch.flatten(coords, 1) # 2, Wh*Ww
118
+ relative_coords = coords_flatten[:, :, None] - coords_flatten[:, None, :] # 2, Wh*Ww, Wh*Ww
119
+ relative_coords = relative_coords.permute(1, 2, 0).contiguous() # Wh*Ww, Wh*Ww, 2
120
+ relative_coords[:, :, 0] += self.window_size[0] - 1 # shift to start from 0
121
+ relative_coords[:, :, 1] += self.window_size[1] - 1
122
+ relative_coords[:, :, 0] *= 2 * self.window_size[1] - 1
123
+ relative_position_index = relative_coords.sum(-1) # Wh*Ww, Wh*Ww
124
+ self.register_buffer("relative_position_index", relative_position_index)
125
+
126
+ self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
127
+ self.attn_drop = nn.Dropout(attn_drop)
128
+ self.proj = nn.Linear(dim, dim)
129
+ self.proj_drop = nn.Dropout(proj_drop)
130
+
131
+ trunc_normal_(self.relative_position_bias_table, std=0.02)
132
+ self.softmax = nn.Softmax(dim=-1)
133
+
134
+ def forward(self, x, mask=None):
135
+ """Forward function.
136
+ Args:
137
+ x: input features with shape of (num_windows*B, N, C)
138
+ mask: (0/-inf) mask with shape of (num_windows, Wh*Ww, Wh*Ww) or None
139
+ """
140
+ B_, N, C = x.shape
141
+ qkv = (
142
+ self.qkv(x)
143
+ .reshape(B_, N, 3, self.num_heads, C // self.num_heads)
144
+ .permute(2, 0, 3, 1, 4)
145
+ )
146
+ q, k, v = qkv[0], qkv[1], qkv[2] # make torchscript happy (cannot use tensor as tuple)
147
+
148
+ q = q * self.scale
149
+ attn = q @ k.transpose(-2, -1)
150
+
151
+ relative_position_bias = self.relative_position_bias_table[
152
+ self.relative_position_index.view(-1)
153
+ ].view(
154
+ self.window_size[0] * self.window_size[1], self.window_size[0] * self.window_size[1], -1
155
+ ) # Wh*Ww,Wh*Ww,nH
156
+ relative_position_bias = relative_position_bias.permute(
157
+ 2, 0, 1
158
+ ).contiguous() # nH, Wh*Ww, Wh*Ww
159
+ attn = attn + relative_position_bias.unsqueeze(0)
160
+
161
+ if mask is not None:
162
+ nW = mask.shape[0]
163
+ attn = attn.view(B_ // nW, nW, self.num_heads, N, N) + mask.unsqueeze(1).unsqueeze(0)
164
+ attn = attn.view(-1, self.num_heads, N, N)
165
+ attn = self.softmax(attn)
166
+ else:
167
+ attn = self.softmax(attn)
168
+
169
+ attn = self.attn_drop(attn)
170
+
171
+ x = (attn @ v).transpose(1, 2).reshape(B_, N, C)
172
+ x = self.proj(x)
173
+ x = self.proj_drop(x)
174
+ return x
175
+
176
+
177
+ class SwinTransformerBlock(nn.Module):
178
+ """Swin Transformer Block.
179
+ Args:
180
+ dim (int): Number of input channels.
181
+ num_heads (int): Number of attention heads.
182
+ window_size (int): Window size.
183
+ shift_size (int): Shift size for SW-MSA.
184
+ mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
185
+ qkv_bias (bool, optional): If True, add a learnable bias to query, key, value. Default: True
186
+ qk_scale (float | None, optional): Override default qk scale of head_dim ** -0.5 if set.
187
+ drop (float, optional): Dropout rate. Default: 0.0
188
+ attn_drop (float, optional): Attention dropout rate. Default: 0.0
189
+ drop_path (float, optional): Stochastic depth rate. Default: 0.0
190
+ act_layer (nn.Module, optional): Activation layer. Default: nn.GELU
191
+ norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm
192
+ """
193
+
194
+ def __init__(
195
+ self,
196
+ dim,
197
+ num_heads,
198
+ window_size=7,
199
+ shift_size=0,
200
+ mlp_ratio=4.0,
201
+ qkv_bias=True,
202
+ qk_scale=None,
203
+ drop=0.0,
204
+ attn_drop=0.0,
205
+ drop_path=0.0,
206
+ act_layer=nn.GELU,
207
+ norm_layer=nn.LayerNorm,
208
+ ):
209
+ super().__init__()
210
+ self.dim = dim
211
+ self.num_heads = num_heads
212
+ self.window_size = window_size
213
+ self.shift_size = shift_size
214
+ self.mlp_ratio = mlp_ratio
215
+ assert 0 <= self.shift_size < self.window_size, "shift_size must in 0-window_size"
216
+
217
+ self.norm1 = norm_layer(dim)
218
+ self.attn = WindowAttention(
219
+ dim,
220
+ window_size=to_2tuple(self.window_size),
221
+ num_heads=num_heads,
222
+ qkv_bias=qkv_bias,
223
+ qk_scale=qk_scale,
224
+ attn_drop=attn_drop,
225
+ proj_drop=drop,
226
+ )
227
+
228
+ self.drop_path = DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
229
+ self.norm2 = norm_layer(dim)
230
+ mlp_hidden_dim = int(dim * mlp_ratio)
231
+ self.mlp = Mlp(
232
+ in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop
233
+ )
234
+
235
+ self.H = None
236
+ self.W = None
237
+
238
+ def forward(self, x, mask_matrix):
239
+ """Forward function.
240
+ Args:
241
+ x: Input feature, tensor size (B, H*W, C).
242
+ H, W: Spatial resolution of the input feature.
243
+ mask_matrix: Attention mask for cyclic shift.
244
+ """
245
+ B, L, C = x.shape
246
+ H, W = self.H, self.W
247
+ assert L == H * W, "input feature has wrong size"
248
+
249
+ shortcut = x
250
+ x = self.norm1(x)
251
+ x = x.view(B, H, W, C)
252
+
253
+ # pad feature maps to multiples of window size
254
+ pad_l = pad_t = 0
255
+ pad_r = (self.window_size - W % self.window_size) % self.window_size
256
+ pad_b = (self.window_size - H % self.window_size) % self.window_size
257
+ x = F.pad(x, (0, 0, pad_l, pad_r, pad_t, pad_b))
258
+ _, Hp, Wp, _ = x.shape
259
+
260
+ # cyclic shift
261
+ if self.shift_size > 0:
262
+ shifted_x = torch.roll(x, shifts=(-self.shift_size, -self.shift_size), dims=(1, 2))
263
+ attn_mask = mask_matrix
264
+ else:
265
+ shifted_x = x
266
+ attn_mask = None
267
+
268
+ # partition windows
269
+ x_windows = window_partition(
270
+ shifted_x, self.window_size
271
+ ) # nW*B, window_size, window_size, C
272
+ x_windows = x_windows.view(
273
+ -1, self.window_size * self.window_size, C
274
+ ) # nW*B, window_size*window_size, C
275
+
276
+ # W-MSA/SW-MSA
277
+ attn_windows = self.attn(x_windows, mask=attn_mask) # nW*B, window_size*window_size, C
278
+
279
+ # merge windows
280
+ attn_windows = attn_windows.view(-1, self.window_size, self.window_size, C)
281
+ shifted_x = window_reverse(attn_windows, self.window_size, Hp, Wp) # B H' W' C
282
+
283
+ # reverse cyclic shift
284
+ if self.shift_size > 0:
285
+ x = torch.roll(shifted_x, shifts=(self.shift_size, self.shift_size), dims=(1, 2))
286
+ else:
287
+ x = shifted_x
288
+
289
+ if pad_r > 0 or pad_b > 0:
290
+ x = x[:, :H, :W, :].contiguous()
291
+
292
+ x = x.view(B, H * W, C)
293
+
294
+ # FFN
295
+ x = shortcut + self.drop_path(x)
296
+ x = x + self.drop_path(self.mlp(self.norm2(x)))
297
+
298
+ return x
299
+
300
+
301
+ class PatchMerging(nn.Module):
302
+ """Patch Merging Layer
303
+ Args:
304
+ dim (int): Number of input channels.
305
+ norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm
306
+ """
307
+
308
+ def __init__(self, dim, norm_layer=nn.LayerNorm):
309
+ super().__init__()
310
+ self.dim = dim
311
+ self.reduction = nn.Linear(4 * dim, 2 * dim, bias=False)
312
+ self.norm = norm_layer(4 * dim)
313
+
314
+ def forward(self, x, H, W):
315
+ """Forward function.
316
+ Args:
317
+ x: Input feature, tensor size (B, H*W, C).
318
+ H, W: Spatial resolution of the input feature.
319
+ """
320
+ B, L, C = x.shape
321
+ assert L == H * W, "input feature has wrong size"
322
+
323
+ x = x.view(B, H, W, C)
324
+
325
+ # padding
326
+ pad_input = (H % 2 == 1) or (W % 2 == 1)
327
+ if pad_input:
328
+ x = F.pad(x, (0, 0, 0, W % 2, 0, H % 2))
329
+
330
+ x0 = x[:, 0::2, 0::2, :] # B H/2 W/2 C
331
+ x1 = x[:, 1::2, 0::2, :] # B H/2 W/2 C
332
+ x2 = x[:, 0::2, 1::2, :] # B H/2 W/2 C
333
+ x3 = x[:, 1::2, 1::2, :] # B H/2 W/2 C
334
+ x = torch.cat([x0, x1, x2, x3], -1) # B H/2 W/2 4*C
335
+ x = x.view(B, -1, 4 * C) # B H/2*W/2 4*C
336
+
337
+ x = self.norm(x)
338
+ x = self.reduction(x)
339
+
340
+ return x
341
+
342
+
343
+ class BasicLayer(nn.Module):
344
+ """A basic Swin Transformer layer for one stage.
345
+ Args:
346
+ dim (int): Number of feature channels
347
+ depth (int): Depths of this stage.
348
+ num_heads (int): Number of attention head.
349
+ window_size (int): Local window size. Default: 7.
350
+ mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4.
351
+ qkv_bias (bool, optional): If True, add a learnable bias to query, key, value. Default: True
352
+ qk_scale (float | None, optional): Override default qk scale of head_dim ** -0.5 if set.
353
+ drop (float, optional): Dropout rate. Default: 0.0
354
+ attn_drop (float, optional): Attention dropout rate. Default: 0.0
355
+ drop_path (float | tuple[float], optional): Stochastic depth rate. Default: 0.0
356
+ norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm
357
+ downsample (nn.Module | None, optional): Downsample layer at the end of the layer. Default: None
358
+ use_checkpoint (bool): Whether to use checkpointing to save memory. Default: False.
359
+ """
360
+
361
+ def __init__(
362
+ self,
363
+ dim,
364
+ depth,
365
+ num_heads,
366
+ window_size=7,
367
+ mlp_ratio=4.0,
368
+ qkv_bias=True,
369
+ qk_scale=None,
370
+ drop=0.0,
371
+ attn_drop=0.0,
372
+ drop_path=0.0,
373
+ norm_layer=nn.LayerNorm,
374
+ downsample=None,
375
+ use_checkpoint=False,
376
+ ):
377
+ super().__init__()
378
+ self.window_size = window_size
379
+ self.shift_size = window_size // 2
380
+ self.depth = depth
381
+ self.use_checkpoint = use_checkpoint
382
+
383
+ # build blocks
384
+ self.blocks = nn.ModuleList(
385
+ [
386
+ SwinTransformerBlock(
387
+ dim=dim,
388
+ num_heads=num_heads,
389
+ window_size=window_size,
390
+ shift_size=0 if (i % 2 == 0) else window_size // 2,
391
+ mlp_ratio=mlp_ratio,
392
+ qkv_bias=qkv_bias,
393
+ qk_scale=qk_scale,
394
+ drop=drop,
395
+ attn_drop=attn_drop,
396
+ drop_path=drop_path[i] if isinstance(drop_path, list) else drop_path,
397
+ norm_layer=norm_layer,
398
+ )
399
+ for i in range(depth)
400
+ ]
401
+ )
402
+
403
+ # patch merging layer
404
+ if downsample is not None:
405
+ self.downsample = downsample(dim=dim, norm_layer=norm_layer)
406
+ else:
407
+ self.downsample = None
408
+
409
+ def forward(self, x, H, W):
410
+ """Forward function.
411
+ Args:
412
+ x: Input feature, tensor size (B, H*W, C).
413
+ H, W: Spatial resolution of the input feature.
414
+ """
415
+
416
+ # calculate attention mask for SW-MSA
417
+ Hp = int(np.ceil(H / self.window_size)) * self.window_size
418
+ Wp = int(np.ceil(W / self.window_size)) * self.window_size
419
+ img_mask = torch.zeros((1, Hp, Wp, 1), device=x.device) # 1 Hp Wp 1
420
+ h_slices = (
421
+ slice(0, -self.window_size),
422
+ slice(-self.window_size, -self.shift_size),
423
+ slice(-self.shift_size, None),
424
+ )
425
+ w_slices = (
426
+ slice(0, -self.window_size),
427
+ slice(-self.window_size, -self.shift_size),
428
+ slice(-self.shift_size, None),
429
+ )
430
+ cnt = 0
431
+ for h in h_slices:
432
+ for w in w_slices:
433
+ img_mask[:, h, w, :] = cnt
434
+ cnt += 1
435
+
436
+ mask_windows = window_partition(
437
+ img_mask, self.window_size
438
+ ) # nW, window_size, window_size, 1
439
+ mask_windows = mask_windows.view(-1, self.window_size * self.window_size)
440
+ attn_mask = mask_windows.unsqueeze(1) - mask_windows.unsqueeze(2)
441
+ attn_mask = attn_mask.masked_fill(attn_mask != 0, float(-100.0)).masked_fill(
442
+ attn_mask == 0, float(0.0)
443
+ )
444
+
445
+ for blk in self.blocks:
446
+ blk.H, blk.W = H, W
447
+ if self.use_checkpoint:
448
+ x = checkpoint.checkpoint(blk, x, attn_mask)
449
+ else:
450
+ x = blk(x, attn_mask)
451
+ if self.downsample is not None:
452
+ x_down = self.downsample(x, H, W)
453
+ Wh, Ww = (H + 1) // 2, (W + 1) // 2
454
+ return x, H, W, x_down, Wh, Ww
455
+ else:
456
+ return x, H, W, x, H, W
457
+
458
+
459
+ class PatchEmbed(nn.Module):
460
+ """Image to Patch Embedding
461
+ Args:
462
+ patch_size (int): Patch token size. Default: 4.
463
+ in_chans (int): Number of input image channels. Default: 3.
464
+ embed_dim (int): Number of linear projection output channels. Default: 96.
465
+ norm_layer (nn.Module, optional): Normalization layer. Default: None
466
+ """
467
+
468
+ def __init__(self, patch_size=4, in_chans=3, embed_dim=96, norm_layer=None):
469
+ super().__init__()
470
+ patch_size = to_2tuple(patch_size)
471
+ self.patch_size = patch_size
472
+
473
+ self.in_chans = in_chans
474
+ self.embed_dim = embed_dim
475
+
476
+ self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size)
477
+ if norm_layer is not None:
478
+ self.norm = norm_layer(embed_dim)
479
+ else:
480
+ self.norm = None
481
+
482
+ def forward(self, x):
483
+ """Forward function."""
484
+ # padding
485
+ _, _, H, W = x.size()
486
+ if W % self.patch_size[1] != 0:
487
+ x = F.pad(x, (0, self.patch_size[1] - W % self.patch_size[1]))
488
+ if H % self.patch_size[0] != 0:
489
+ x = F.pad(x, (0, 0, 0, self.patch_size[0] - H % self.patch_size[0]))
490
+
491
+ x = self.proj(x) # B C Wh Ww
492
+ if self.norm is not None:
493
+ Wh, Ww = x.size(2), x.size(3)
494
+ x = x.flatten(2).transpose(1, 2)
495
+ x = self.norm(x)
496
+ x = x.transpose(1, 2).view(-1, self.embed_dim, Wh, Ww)
497
+
498
+ return x
499
+
500
+
501
+ class SwinTransformer(nn.Module):
502
+ """Swin Transformer backbone.
503
+ A PyTorch impl of : `Swin Transformer: Hierarchical Vision Transformer using Shifted Windows` -
504
+ https://arxiv.org/pdf/2103.14030
505
+ Args:
506
+ pretrain_img_size (int): Input image size for training the pretrained model,
507
+ used in absolute postion embedding. Default 224.
508
+ patch_size (int | tuple(int)): Patch size. Default: 4.
509
+ in_chans (int): Number of input image channels. Default: 3.
510
+ embed_dim (int): Number of linear projection output channels. Default: 96.
511
+ depths (tuple[int]): Depths of each Swin Transformer stage.
512
+ num_heads (tuple[int]): Number of attention head of each stage.
513
+ window_size (int): Window size. Default: 7.
514
+ mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4.
515
+ qkv_bias (bool): If True, add a learnable bias to query, key, value. Default: True
516
+ qk_scale (float): Override default qk scale of head_dim ** -0.5 if set.
517
+ drop_rate (float): Dropout rate.
518
+ attn_drop_rate (float): Attention dropout rate. Default: 0.
519
+ drop_path_rate (float): Stochastic depth rate. Default: 0.2.
520
+ norm_layer (nn.Module): Normalization layer. Default: nn.LayerNorm.
521
+ ape (bool): If True, add absolute position embedding to the patch embedding. Default: False.
522
+ patch_norm (bool): If True, add normalization after patch embedding. Default: True.
523
+ out_indices (Sequence[int]): Output from which stages.
524
+ frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
525
+ -1 means not freezing any parameters.
526
+ use_checkpoint (bool): Whether to use checkpointing to save memory. Default: False.
527
+ dilation (bool): if True, the output size if 16x downsample, ow 32x downsample.
528
+ """
529
+
530
+ def __init__(
531
+ self,
532
+ pretrain_img_size=224,
533
+ patch_size=4,
534
+ in_chans=3,
535
+ embed_dim=96,
536
+ depths=[2, 2, 6, 2],
537
+ num_heads=[3, 6, 12, 24],
538
+ window_size=7,
539
+ mlp_ratio=4.0,
540
+ qkv_bias=True,
541
+ qk_scale=None,
542
+ drop_rate=0.0,
543
+ attn_drop_rate=0.0,
544
+ drop_path_rate=0.2,
545
+ norm_layer=nn.LayerNorm,
546
+ ape=False,
547
+ patch_norm=True,
548
+ out_indices=(0, 1, 2, 3),
549
+ frozen_stages=-1,
550
+ dilation=False,
551
+ use_checkpoint=False,
552
+ ):
553
+ super().__init__()
554
+
555
+ self.pretrain_img_size = pretrain_img_size
556
+ self.num_layers = len(depths)
557
+ self.embed_dim = embed_dim
558
+ self.ape = ape
559
+ self.patch_norm = patch_norm
560
+ self.out_indices = out_indices
561
+ self.frozen_stages = frozen_stages
562
+ self.dilation = dilation
563
+
564
+ # if use_checkpoint:
565
+ # print("use_checkpoint!!!!!!!!!!!!!!!!!!!!!!!!")
566
+
567
+ # split image into non-overlapping patches
568
+ self.patch_embed = PatchEmbed(
569
+ patch_size=patch_size,
570
+ in_chans=in_chans,
571
+ embed_dim=embed_dim,
572
+ norm_layer=norm_layer if self.patch_norm else None,
573
+ )
574
+
575
+ # absolute position embedding
576
+ if self.ape:
577
+ pretrain_img_size = to_2tuple(pretrain_img_size)
578
+ patch_size = to_2tuple(patch_size)
579
+ patches_resolution = [
580
+ pretrain_img_size[0] // patch_size[0],
581
+ pretrain_img_size[1] // patch_size[1],
582
+ ]
583
+
584
+ self.absolute_pos_embed = nn.Parameter(
585
+ torch.zeros(1, embed_dim, patches_resolution[0], patches_resolution[1])
586
+ )
587
+ trunc_normal_(self.absolute_pos_embed, std=0.02)
588
+
589
+ self.pos_drop = nn.Dropout(p=drop_rate)
590
+
591
+ # stochastic depth
592
+ dpr = [
593
+ x.item() for x in torch.linspace(0, drop_path_rate, sum(depths))
594
+ ] # stochastic depth decay rule
595
+
596
+ # build layers
597
+ self.layers = nn.ModuleList()
598
+ # prepare downsample list
599
+ downsamplelist = [PatchMerging for i in range(self.num_layers)]
600
+ downsamplelist[-1] = None
601
+ num_features = [int(embed_dim * 2**i) for i in range(self.num_layers)]
602
+ if self.dilation:
603
+ downsamplelist[-2] = None
604
+ num_features[-1] = int(embed_dim * 2 ** (self.num_layers - 1)) // 2
605
+ for i_layer in range(self.num_layers):
606
+ layer = BasicLayer(
607
+ # dim=int(embed_dim * 2 ** i_layer),
608
+ dim=num_features[i_layer],
609
+ depth=depths[i_layer],
610
+ num_heads=num_heads[i_layer],
611
+ window_size=window_size,
612
+ mlp_ratio=mlp_ratio,
613
+ qkv_bias=qkv_bias,
614
+ qk_scale=qk_scale,
615
+ drop=drop_rate,
616
+ attn_drop=attn_drop_rate,
617
+ drop_path=dpr[sum(depths[:i_layer]) : sum(depths[: i_layer + 1])],
618
+ norm_layer=norm_layer,
619
+ # downsample=PatchMerging if (i_layer < self.num_layers - 1) else None,
620
+ downsample=downsamplelist[i_layer],
621
+ use_checkpoint=use_checkpoint,
622
+ )
623
+ self.layers.append(layer)
624
+
625
+ # num_features = [int(embed_dim * 2 ** i) for i in range(self.num_layers)]
626
+ self.num_features = num_features
627
+
628
+ # add a norm layer for each output
629
+ for i_layer in out_indices:
630
+ layer = norm_layer(num_features[i_layer])
631
+ layer_name = f"norm{i_layer}"
632
+ self.add_module(layer_name, layer)
633
+
634
+ self._freeze_stages()
635
+
636
+ def _freeze_stages(self):
637
+ if self.frozen_stages >= 0:
638
+ self.patch_embed.eval()
639
+ for param in self.patch_embed.parameters():
640
+ param.requires_grad = False
641
+
642
+ if self.frozen_stages >= 1 and self.ape:
643
+ self.absolute_pos_embed.requires_grad = False
644
+
645
+ if self.frozen_stages >= 2:
646
+ self.pos_drop.eval()
647
+ for i in range(0, self.frozen_stages - 1):
648
+ m = self.layers[i]
649
+ m.eval()
650
+ for param in m.parameters():
651
+ param.requires_grad = False
652
+
653
+ # def init_weights(self, pretrained=None):
654
+ # """Initialize the weights in backbone.
655
+ # Args:
656
+ # pretrained (str, optional): Path to pre-trained weights.
657
+ # Defaults to None.
658
+ # """
659
+
660
+ # def _init_weights(m):
661
+ # if isinstance(m, nn.Linear):
662
+ # trunc_normal_(m.weight, std=.02)
663
+ # if isinstance(m, nn.Linear) and m.bias is not None:
664
+ # nn.init.constant_(m.bias, 0)
665
+ # elif isinstance(m, nn.LayerNorm):
666
+ # nn.init.constant_(m.bias, 0)
667
+ # nn.init.constant_(m.weight, 1.0)
668
+
669
+ # if isinstance(pretrained, str):
670
+ # self.apply(_init_weights)
671
+ # logger = get_root_logger()
672
+ # load_checkpoint(self, pretrained, strict=False, logger=logger)
673
+ # elif pretrained is None:
674
+ # self.apply(_init_weights)
675
+ # else:
676
+ # raise TypeError('pretrained must be a str or None')
677
+
678
+ def forward_raw(self, x):
679
+ """Forward function."""
680
+ x = self.patch_embed(x)
681
+
682
+ Wh, Ww = x.size(2), x.size(3)
683
+ if self.ape:
684
+ # interpolate the position embedding to the corresponding size
685
+ absolute_pos_embed = F.interpolate(
686
+ self.absolute_pos_embed, size=(Wh, Ww), mode="bicubic"
687
+ )
688
+ x = (x + absolute_pos_embed).flatten(2).transpose(1, 2) # B Wh*Ww C
689
+ else:
690
+ x = x.flatten(2).transpose(1, 2)
691
+ x = self.pos_drop(x)
692
+
693
+ outs = []
694
+ for i in range(self.num_layers):
695
+ layer = self.layers[i]
696
+ x_out, H, W, x, Wh, Ww = layer(x, Wh, Ww)
697
+ # import ipdb; ipdb.set_trace()
698
+
699
+ if i in self.out_indices:
700
+ norm_layer = getattr(self, f"norm{i}")
701
+ x_out = norm_layer(x_out)
702
+
703
+ out = x_out.view(-1, H, W, self.num_features[i]).permute(0, 3, 1, 2).contiguous()
704
+ outs.append(out)
705
+ # in:
706
+ # torch.Size([2, 3, 1024, 1024])
707
+ # outs:
708
+ # [torch.Size([2, 192, 256, 256]), torch.Size([2, 384, 128, 128]), \
709
+ # torch.Size([2, 768, 64, 64]), torch.Size([2, 1536, 32, 32])]
710
+ return tuple(outs)
711
+
712
+ def forward(self, tensor_list: NestedTensor):
713
+ x = tensor_list.tensors
714
+
715
+ """Forward function."""
716
+ x = self.patch_embed(x)
717
+
718
+ Wh, Ww = x.size(2), x.size(3)
719
+ if self.ape:
720
+ # interpolate the position embedding to the corresponding size
721
+ absolute_pos_embed = F.interpolate(
722
+ self.absolute_pos_embed, size=(Wh, Ww), mode="bicubic"
723
+ )
724
+ x = (x + absolute_pos_embed).flatten(2).transpose(1, 2) # B Wh*Ww C
725
+ else:
726
+ x = x.flatten(2).transpose(1, 2)
727
+ x = self.pos_drop(x)
728
+
729
+ outs = []
730
+ for i in range(self.num_layers):
731
+ layer = self.layers[i]
732
+ x_out, H, W, x, Wh, Ww = layer(x, Wh, Ww)
733
+
734
+ if i in self.out_indices:
735
+ norm_layer = getattr(self, f"norm{i}")
736
+ x_out = norm_layer(x_out)
737
+
738
+ out = x_out.view(-1, H, W, self.num_features[i]).permute(0, 3, 1, 2).contiguous()
739
+ outs.append(out)
740
+ # in:
741
+ # torch.Size([2, 3, 1024, 1024])
742
+ # out:
743
+ # [torch.Size([2, 192, 256, 256]), torch.Size([2, 384, 128, 128]), \
744
+ # torch.Size([2, 768, 64, 64]), torch.Size([2, 1536, 32, 32])]
745
+
746
+ # collect for nesttensors
747
+ outs_dict = {}
748
+ for idx, out_i in enumerate(outs):
749
+ m = tensor_list.mask
750
+ assert m is not None
751
+ mask = F.interpolate(m[None].float(), size=out_i.shape[-2:]).to(torch.bool)[0]
752
+ outs_dict[idx] = NestedTensor(out_i, mask)
753
+
754
+ return outs_dict
755
+
756
+ def train(self, mode=True):
757
+ """Convert the model into training mode while keep layers freezed."""
758
+ super(SwinTransformer, self).train(mode)
759
+ self._freeze_stages()
760
+
761
+
762
+ def build_swin_transformer(modelname, pretrain_img_size, **kw):
763
+ assert modelname in [
764
+ "swin_T_224_1k",
765
+ "swin_B_224_22k",
766
+ "swin_B_384_22k",
767
+ "swin_L_224_22k",
768
+ "swin_L_384_22k",
769
+ ]
770
+
771
+ model_para_dict = {
772
+ "swin_T_224_1k": dict(
773
+ embed_dim=96, depths=[2, 2, 6, 2], num_heads=[3, 6, 12, 24], window_size=7
774
+ ),
775
+ "swin_B_224_22k": dict(
776
+ embed_dim=128, depths=[2, 2, 18, 2], num_heads=[4, 8, 16, 32], window_size=7
777
+ ),
778
+ "swin_B_384_22k": dict(
779
+ embed_dim=128, depths=[2, 2, 18, 2], num_heads=[4, 8, 16, 32], window_size=12
780
+ ),
781
+ "swin_L_224_22k": dict(
782
+ embed_dim=192, depths=[2, 2, 18, 2], num_heads=[6, 12, 24, 48], window_size=7
783
+ ),
784
+ "swin_L_384_22k": dict(
785
+ embed_dim=192, depths=[2, 2, 18, 2], num_heads=[6, 12, 24, 48], window_size=12
786
+ ),
787
+ }
788
+ kw_cgf = model_para_dict[modelname]
789
+ kw_cgf.update(kw)
790
+ model = SwinTransformer(pretrain_img_size=pretrain_img_size, **kw_cgf)
791
+ return model
792
+
793
+
794
+ if __name__ == "__main__":
795
+ model = build_swin_transformer("swin_L_384_22k", 384, dilation=True)
796
+ x = torch.rand(2, 3, 1024, 1024)
797
+ y = model.forward_raw(x)
798
+ import ipdb
799
+
800
+ ipdb.set_trace()
801
+ x = torch.rand(2, 3, 384, 384)
802
+ y = model.forward_raw(x)
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/bertwarper.py ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+
8
+ import torch
9
+ from torch import nn
10
+ from transformers.modeling_outputs import BaseModelOutputWithPoolingAndCrossAttentions
11
+
12
+
13
+ class BertModelWarper(nn.Module):
14
+ def __init__(self, bert_model):
15
+ super().__init__()
16
+ # self.bert = bert_modelc
17
+
18
+ self.config = bert_model.config
19
+ self.embeddings = bert_model.embeddings
20
+ self.encoder = bert_model.encoder
21
+ self.pooler = bert_model.pooler
22
+
23
+ self.get_extended_attention_mask = bert_model.get_extended_attention_mask
24
+ self.invert_attention_mask = bert_model.invert_attention_mask
25
+ self.get_head_mask = bert_model.get_head_mask
26
+
27
+ def forward(
28
+ self,
29
+ input_ids=None,
30
+ attention_mask=None,
31
+ token_type_ids=None,
32
+ position_ids=None,
33
+ head_mask=None,
34
+ inputs_embeds=None,
35
+ encoder_hidden_states=None,
36
+ encoder_attention_mask=None,
37
+ past_key_values=None,
38
+ use_cache=None,
39
+ output_attentions=None,
40
+ output_hidden_states=None,
41
+ return_dict=None,
42
+ ):
43
+ r"""
44
+ encoder_hidden_states (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size)`, `optional`):
45
+ Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
46
+ the model is configured as a decoder.
47
+ encoder_attention_mask (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
48
+ Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
49
+ the cross-attention if the model is configured as a decoder. Mask values selected in ``[0, 1]``:
50
+
51
+ - 1 for tokens that are **not masked**,
52
+ - 0 for tokens that are **masked**.
53
+ past_key_values (:obj:`tuple(tuple(torch.FloatTensor))` of length :obj:`config.n_layers` with each tuple having 4 tensors of shape :obj:`(batch_size, num_heads, sequence_length - 1, embed_size_per_head)`):
54
+ Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
55
+
56
+ If :obj:`past_key_values` are used, the user can optionally input only the last :obj:`decoder_input_ids`
57
+ (those that don't have their past key value states given to this model) of shape :obj:`(batch_size, 1)`
58
+ instead of all :obj:`decoder_input_ids` of shape :obj:`(batch_size, sequence_length)`.
59
+ use_cache (:obj:`bool`, `optional`):
60
+ If set to :obj:`True`, :obj:`past_key_values` key value states are returned and can be used to speed up
61
+ decoding (see :obj:`past_key_values`).
62
+ """
63
+ output_attentions = (
64
+ output_attentions if output_attentions is not None else self.config.output_attentions
65
+ )
66
+ output_hidden_states = (
67
+ output_hidden_states
68
+ if output_hidden_states is not None
69
+ else self.config.output_hidden_states
70
+ )
71
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
72
+
73
+ if self.config.is_decoder:
74
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
75
+ else:
76
+ use_cache = False
77
+
78
+ if input_ids is not None and inputs_embeds is not None:
79
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
80
+ elif input_ids is not None:
81
+ input_shape = input_ids.size()
82
+ batch_size, seq_length = input_shape
83
+ elif inputs_embeds is not None:
84
+ input_shape = inputs_embeds.size()[:-1]
85
+ batch_size, seq_length = input_shape
86
+ else:
87
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
88
+
89
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
90
+
91
+ # past_key_values_length
92
+ past_key_values_length = (
93
+ past_key_values[0][0].shape[2] if past_key_values is not None else 0
94
+ )
95
+
96
+ if attention_mask is None:
97
+ attention_mask = torch.ones(
98
+ ((batch_size, seq_length + past_key_values_length)), device=device
99
+ )
100
+ if token_type_ids is None:
101
+ token_type_ids = torch.zeros(input_shape, dtype=torch.long, device=device)
102
+
103
+ # We can provide a self-attention mask of dimensions [batch_size, from_seq_length, to_seq_length]
104
+ # ourselves in which case we just need to make it broadcastable to all heads.
105
+ extended_attention_mask: torch.Tensor = self.get_extended_attention_mask(
106
+ attention_mask, input_shape, device
107
+ )
108
+
109
+ # If a 2D or 3D attention mask is provided for the cross-attention
110
+ # we need to make broadcastable to [batch_size, num_heads, seq_length, seq_length]
111
+ if self.config.is_decoder and encoder_hidden_states is not None:
112
+ encoder_batch_size, encoder_sequence_length, _ = encoder_hidden_states.size()
113
+ encoder_hidden_shape = (encoder_batch_size, encoder_sequence_length)
114
+ if encoder_attention_mask is None:
115
+ encoder_attention_mask = torch.ones(encoder_hidden_shape, device=device)
116
+ encoder_extended_attention_mask = self.invert_attention_mask(encoder_attention_mask)
117
+ else:
118
+ encoder_extended_attention_mask = None
119
+ # if os.environ.get('IPDB_SHILONG_DEBUG', None) == 'INFO':
120
+ # import ipdb; ipdb.set_trace()
121
+
122
+ # Prepare head mask if needed
123
+ # 1.0 in head_mask indicate we keep the head
124
+ # attention_probs has shape bsz x n_heads x N x N
125
+ # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
126
+ # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
127
+ head_mask = self.get_head_mask(head_mask, self.config.num_hidden_layers)
128
+
129
+ embedding_output = self.embeddings(
130
+ input_ids=input_ids,
131
+ position_ids=position_ids,
132
+ token_type_ids=token_type_ids,
133
+ inputs_embeds=inputs_embeds,
134
+ past_key_values_length=past_key_values_length,
135
+ )
136
+
137
+ encoder_outputs = self.encoder(
138
+ embedding_output,
139
+ attention_mask=extended_attention_mask,
140
+ head_mask=head_mask,
141
+ encoder_hidden_states=encoder_hidden_states,
142
+ encoder_attention_mask=encoder_extended_attention_mask,
143
+ past_key_values=past_key_values,
144
+ use_cache=use_cache,
145
+ output_attentions=output_attentions,
146
+ output_hidden_states=output_hidden_states,
147
+ return_dict=return_dict,
148
+ )
149
+ sequence_output = encoder_outputs[0]
150
+ pooled_output = self.pooler(sequence_output) if self.pooler is not None else None
151
+
152
+ if not return_dict:
153
+ return (sequence_output, pooled_output) + encoder_outputs[1:]
154
+
155
+ return BaseModelOutputWithPoolingAndCrossAttentions(
156
+ last_hidden_state=sequence_output,
157
+ pooler_output=pooled_output,
158
+ past_key_values=encoder_outputs.past_key_values,
159
+ hidden_states=encoder_outputs.hidden_states,
160
+ attentions=encoder_outputs.attentions,
161
+ cross_attentions=encoder_outputs.cross_attentions,
162
+ )
163
+
164
+
165
+ class TextEncoderShell(nn.Module):
166
+ def __init__(self, text_encoder):
167
+ super().__init__()
168
+ self.text_encoder = text_encoder
169
+ self.config = self.text_encoder.config
170
+
171
+ def forward(self, **kw):
172
+ # feed into text encoder
173
+ return self.text_encoder(**kw)
174
+
175
+
176
+ def generate_masks_with_special_tokens(tokenized, special_tokens_list, tokenizer):
177
+ """Generate attention mask between each pair of special tokens
178
+ Args:
179
+ input_ids (torch.Tensor): input ids. Shape: [bs, num_token]
180
+ special_tokens_mask (list): special tokens mask.
181
+ Returns:
182
+ torch.Tensor: attention mask between each special tokens.
183
+ """
184
+ input_ids = tokenized["input_ids"]
185
+ bs, num_token = input_ids.shape
186
+ # special_tokens_mask: bs, num_token. 1 for special tokens. 0 for normal tokens
187
+ special_tokens_mask = torch.zeros((bs, num_token), device=input_ids.device).bool()
188
+ for special_token in special_tokens_list:
189
+ special_tokens_mask |= input_ids == special_token
190
+
191
+ # idxs: each row is a list of indices of special tokens
192
+ idxs = torch.nonzero(special_tokens_mask)
193
+
194
+ # generate attention mask and positional ids
195
+ attention_mask = (
196
+ torch.eye(num_token, device=input_ids.device).bool().unsqueeze(0).repeat(bs, 1, 1)
197
+ )
198
+ position_ids = torch.zeros((bs, num_token), device=input_ids.device)
199
+ previous_col = 0
200
+ for i in range(idxs.shape[0]):
201
+ row, col = idxs[i]
202
+ if (col == 0) or (col == num_token - 1):
203
+ attention_mask[row, col, col] = True
204
+ position_ids[row, col] = 0
205
+ else:
206
+ attention_mask[row, previous_col + 1 : col + 1, previous_col + 1 : col + 1] = True
207
+ position_ids[row, previous_col + 1 : col + 1] = torch.arange(
208
+ 0, col - previous_col, device=input_ids.device
209
+ )
210
+
211
+ previous_col = col
212
+
213
+ # # padding mask
214
+ # padding_mask = tokenized['attention_mask']
215
+ # attention_mask = attention_mask & padding_mask.unsqueeze(1).bool() & padding_mask.unsqueeze(2).bool()
216
+
217
+ return attention_mask, position_ids.to(torch.long)
218
+
219
+
220
+ def generate_masks_with_special_tokens_and_transfer_map(tokenized, special_tokens_list, tokenizer):
221
+ """Generate attention mask between each pair of special tokens
222
+ Args:
223
+ input_ids (torch.Tensor): input ids. Shape: [bs, num_token]
224
+ special_tokens_mask (list): special tokens mask.
225
+ Returns:
226
+ torch.Tensor: attention mask between each special tokens.
227
+ """
228
+ input_ids = tokenized["input_ids"]
229
+ bs, num_token = input_ids.shape
230
+ # special_tokens_mask: bs, num_token. 1 for special tokens. 0 for normal tokens
231
+ special_tokens_mask = torch.zeros((bs, num_token), device=input_ids.device).bool()
232
+ for special_token in special_tokens_list:
233
+ special_tokens_mask |= input_ids == special_token
234
+
235
+ # idxs: each row is a list of indices of special tokens
236
+ idxs = torch.nonzero(special_tokens_mask)
237
+
238
+ # generate attention mask and positional ids
239
+ attention_mask = (
240
+ torch.eye(num_token, device=input_ids.device).bool().unsqueeze(0).repeat(bs, 1, 1)
241
+ )
242
+ position_ids = torch.zeros((bs, num_token), device=input_ids.device)
243
+ cate_to_token_mask_list = [[] for _ in range(bs)]
244
+ previous_col = 0
245
+ for i in range(idxs.shape[0]):
246
+ row, col = idxs[i]
247
+ if (col == 0) or (col == num_token - 1):
248
+ attention_mask[row, col, col] = True
249
+ position_ids[row, col] = 0
250
+ else:
251
+ attention_mask[row, previous_col + 1 : col + 1, previous_col + 1 : col + 1] = True
252
+ position_ids[row, previous_col + 1 : col + 1] = torch.arange(
253
+ 0, col - previous_col, device=input_ids.device
254
+ )
255
+ c2t_maski = torch.zeros((num_token), device=input_ids.device).bool()
256
+ c2t_maski[previous_col + 1 : col] = True
257
+ cate_to_token_mask_list[row].append(c2t_maski)
258
+ previous_col = col
259
+
260
+ cate_to_token_mask_list = [
261
+ torch.stack(cate_to_token_mask_listi, dim=0)
262
+ for cate_to_token_mask_listi in cate_to_token_mask_list
263
+ ]
264
+
265
+ # # padding mask
266
+ # padding_mask = tokenized['attention_mask']
267
+ # attention_mask = attention_mask & padding_mask.unsqueeze(1).bool() & padding_mask.unsqueeze(2).bool()
268
+
269
+ return attention_mask, position_ids.to(torch.long), cate_to_token_mask_list
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/fuse_modules.py ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+
8
+ import torch
9
+ import torch.nn as nn
10
+ import torch.nn.functional as F
11
+ from timm.models.layers import DropPath
12
+
13
+
14
+ class FeatureResizer(nn.Module):
15
+ """
16
+ This class takes as input a set of embeddings of dimension C1 and outputs a set of
17
+ embedding of dimension C2, after a linear transformation, dropout and normalization (LN).
18
+ """
19
+
20
+ def __init__(self, input_feat_size, output_feat_size, dropout, do_ln=True):
21
+ super().__init__()
22
+ self.do_ln = do_ln
23
+ # Object feature encoding
24
+ self.fc = nn.Linear(input_feat_size, output_feat_size, bias=True)
25
+ self.layer_norm = nn.LayerNorm(output_feat_size, eps=1e-12)
26
+ self.dropout = nn.Dropout(dropout)
27
+
28
+ def forward(self, encoder_features):
29
+ x = self.fc(encoder_features)
30
+ if self.do_ln:
31
+ x = self.layer_norm(x)
32
+ output = self.dropout(x)
33
+ return output
34
+
35
+
36
+ def l1norm(X, dim, eps=1e-8):
37
+ """L1-normalize columns of X"""
38
+ norm = torch.abs(X).sum(dim=dim, keepdim=True) + eps
39
+ X = torch.div(X, norm)
40
+ return X
41
+
42
+
43
+ def l2norm(X, dim, eps=1e-8):
44
+ """L2-normalize columns of X"""
45
+ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps
46
+ X = torch.div(X, norm)
47
+ return X
48
+
49
+
50
+ def func_attention(query, context, smooth=1, raw_feature_norm="softmax", eps=1e-8):
51
+ """
52
+ query: (n_context, queryL, d)
53
+ context: (n_context, sourceL, d)
54
+ """
55
+ batch_size_q, queryL = query.size(0), query.size(1)
56
+ batch_size, sourceL = context.size(0), context.size(1)
57
+
58
+ # Get attention
59
+ # --> (batch, d, queryL)
60
+ queryT = torch.transpose(query, 1, 2)
61
+
62
+ # (batch, sourceL, d)(batch, d, queryL)
63
+ # --> (batch, sourceL, queryL)
64
+ attn = torch.bmm(context, queryT)
65
+ if raw_feature_norm == "softmax":
66
+ # --> (batch*sourceL, queryL)
67
+ attn = attn.view(batch_size * sourceL, queryL)
68
+ attn = nn.Softmax()(attn)
69
+ # --> (batch, sourceL, queryL)
70
+ attn = attn.view(batch_size, sourceL, queryL)
71
+ elif raw_feature_norm == "l2norm":
72
+ attn = l2norm(attn, 2)
73
+ elif raw_feature_norm == "clipped_l2norm":
74
+ attn = nn.LeakyReLU(0.1)(attn)
75
+ attn = l2norm(attn, 2)
76
+ else:
77
+ raise ValueError("unknown first norm type:", raw_feature_norm)
78
+ # --> (batch, queryL, sourceL)
79
+ attn = torch.transpose(attn, 1, 2).contiguous()
80
+ # --> (batch*queryL, sourceL)
81
+ attn = attn.view(batch_size * queryL, sourceL)
82
+ attn = nn.Softmax()(attn * smooth)
83
+ # --> (batch, queryL, sourceL)
84
+ attn = attn.view(batch_size, queryL, sourceL)
85
+ # --> (batch, sourceL, queryL)
86
+ attnT = torch.transpose(attn, 1, 2).contiguous()
87
+
88
+ # --> (batch, d, sourceL)
89
+ contextT = torch.transpose(context, 1, 2)
90
+ # (batch x d x sourceL)(batch x sourceL x queryL)
91
+ # --> (batch, d, queryL)
92
+ weightedContext = torch.bmm(contextT, attnT)
93
+ # --> (batch, queryL, d)
94
+ weightedContext = torch.transpose(weightedContext, 1, 2)
95
+
96
+ return weightedContext, attnT
97
+
98
+
99
+ class BiMultiHeadAttention(nn.Module):
100
+ def __init__(self, v_dim, l_dim, embed_dim, num_heads, dropout=0.1, cfg=None):
101
+ super(BiMultiHeadAttention, self).__init__()
102
+
103
+ self.embed_dim = embed_dim
104
+ self.num_heads = num_heads
105
+ self.head_dim = embed_dim // num_heads
106
+ self.v_dim = v_dim
107
+ self.l_dim = l_dim
108
+
109
+ assert (
110
+ self.head_dim * self.num_heads == self.embed_dim
111
+ ), f"embed_dim must be divisible by num_heads (got `embed_dim`: {self.embed_dim} and `num_heads`: {self.num_heads})."
112
+ self.scale = self.head_dim ** (-0.5)
113
+ self.dropout = dropout
114
+
115
+ self.v_proj = nn.Linear(self.v_dim, self.embed_dim)
116
+ self.l_proj = nn.Linear(self.l_dim, self.embed_dim)
117
+ self.values_v_proj = nn.Linear(self.v_dim, self.embed_dim)
118
+ self.values_l_proj = nn.Linear(self.l_dim, self.embed_dim)
119
+
120
+ self.out_v_proj = nn.Linear(self.embed_dim, self.v_dim)
121
+ self.out_l_proj = nn.Linear(self.embed_dim, self.l_dim)
122
+
123
+ self.stable_softmax_2d = True
124
+ self.clamp_min_for_underflow = True
125
+ self.clamp_max_for_overflow = True
126
+
127
+ self._reset_parameters()
128
+
129
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
130
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
131
+
132
+ def _reset_parameters(self):
133
+ nn.init.xavier_uniform_(self.v_proj.weight)
134
+ self.v_proj.bias.data.fill_(0)
135
+ nn.init.xavier_uniform_(self.l_proj.weight)
136
+ self.l_proj.bias.data.fill_(0)
137
+ nn.init.xavier_uniform_(self.values_v_proj.weight)
138
+ self.values_v_proj.bias.data.fill_(0)
139
+ nn.init.xavier_uniform_(self.values_l_proj.weight)
140
+ self.values_l_proj.bias.data.fill_(0)
141
+ nn.init.xavier_uniform_(self.out_v_proj.weight)
142
+ self.out_v_proj.bias.data.fill_(0)
143
+ nn.init.xavier_uniform_(self.out_l_proj.weight)
144
+ self.out_l_proj.bias.data.fill_(0)
145
+
146
+ def forward(self, v, l, attention_mask_v=None, attention_mask_l=None):
147
+ """_summary_
148
+
149
+ Args:
150
+ v (_type_): bs, n_img, dim
151
+ l (_type_): bs, n_text, dim
152
+ attention_mask_v (_type_, optional): _description_. bs, n_img
153
+ attention_mask_l (_type_, optional): _description_. bs, n_text
154
+
155
+ Returns:
156
+ _type_: _description_
157
+ """
158
+ # if os.environ.get('IPDB_SHILONG_DEBUG', None) == 'INFO':
159
+ # import ipdb; ipdb.set_trace()
160
+ bsz, tgt_len, _ = v.size()
161
+
162
+ query_states = self.v_proj(v) * self.scale
163
+ key_states = self._shape(self.l_proj(l), -1, bsz)
164
+ value_v_states = self._shape(self.values_v_proj(v), -1, bsz)
165
+ value_l_states = self._shape(self.values_l_proj(l), -1, bsz)
166
+
167
+ proj_shape = (bsz * self.num_heads, -1, self.head_dim)
168
+ query_states = self._shape(query_states, tgt_len, bsz).view(*proj_shape)
169
+ key_states = key_states.view(*proj_shape)
170
+ value_v_states = value_v_states.view(*proj_shape)
171
+ value_l_states = value_l_states.view(*proj_shape)
172
+
173
+ src_len = key_states.size(1)
174
+ attn_weights = torch.bmm(query_states, key_states.transpose(1, 2)) # bs*nhead, nimg, ntxt
175
+
176
+ if attn_weights.size() != (bsz * self.num_heads, tgt_len, src_len):
177
+ raise ValueError(
178
+ f"Attention weights should be of size {(bsz * self.num_heads, tgt_len, src_len)}, but is {attn_weights.size()}"
179
+ )
180
+
181
+ if self.stable_softmax_2d:
182
+ attn_weights = attn_weights - attn_weights.max()
183
+
184
+ if self.clamp_min_for_underflow:
185
+ attn_weights = torch.clamp(
186
+ attn_weights, min=-50000
187
+ ) # Do not increase -50000, data type half has quite limited range
188
+ if self.clamp_max_for_overflow:
189
+ attn_weights = torch.clamp(
190
+ attn_weights, max=50000
191
+ ) # Do not increase 50000, data type half has quite limited range
192
+
193
+ attn_weights_T = attn_weights.transpose(1, 2)
194
+ attn_weights_l = attn_weights_T - torch.max(attn_weights_T, dim=-1, keepdim=True)[0]
195
+ if self.clamp_min_for_underflow:
196
+ attn_weights_l = torch.clamp(
197
+ attn_weights_l, min=-50000
198
+ ) # Do not increase -50000, data type half has quite limited range
199
+ if self.clamp_max_for_overflow:
200
+ attn_weights_l = torch.clamp(
201
+ attn_weights_l, max=50000
202
+ ) # Do not increase 50000, data type half has quite limited range
203
+
204
+ # mask vison for language
205
+ if attention_mask_v is not None:
206
+ attention_mask_v = (
207
+ attention_mask_v[:, None, None, :].repeat(1, self.num_heads, 1, 1).flatten(0, 1)
208
+ )
209
+ attn_weights_l.masked_fill_(attention_mask_v, float("-inf"))
210
+
211
+ attn_weights_l = attn_weights_l.softmax(dim=-1)
212
+
213
+ # mask language for vision
214
+ if attention_mask_l is not None:
215
+ attention_mask_l = (
216
+ attention_mask_l[:, None, None, :].repeat(1, self.num_heads, 1, 1).flatten(0, 1)
217
+ )
218
+ attn_weights.masked_fill_(attention_mask_l, float("-inf"))
219
+ attn_weights_v = attn_weights.softmax(dim=-1)
220
+
221
+ attn_probs_v = F.dropout(attn_weights_v, p=self.dropout, training=self.training)
222
+ attn_probs_l = F.dropout(attn_weights_l, p=self.dropout, training=self.training)
223
+
224
+ attn_output_v = torch.bmm(attn_probs_v, value_l_states)
225
+ attn_output_l = torch.bmm(attn_probs_l, value_v_states)
226
+
227
+ if attn_output_v.size() != (bsz * self.num_heads, tgt_len, self.head_dim):
228
+ raise ValueError(
229
+ f"`attn_output_v` should be of size {(bsz, self.num_heads, tgt_len, self.head_dim)}, but is {attn_output_v.size()}"
230
+ )
231
+
232
+ if attn_output_l.size() != (bsz * self.num_heads, src_len, self.head_dim):
233
+ raise ValueError(
234
+ f"`attn_output_l` should be of size {(bsz, self.num_heads, src_len, self.head_dim)}, but is {attn_output_l.size()}"
235
+ )
236
+
237
+ attn_output_v = attn_output_v.view(bsz, self.num_heads, tgt_len, self.head_dim)
238
+ attn_output_v = attn_output_v.transpose(1, 2)
239
+ attn_output_v = attn_output_v.reshape(bsz, tgt_len, self.embed_dim)
240
+
241
+ attn_output_l = attn_output_l.view(bsz, self.num_heads, src_len, self.head_dim)
242
+ attn_output_l = attn_output_l.transpose(1, 2)
243
+ attn_output_l = attn_output_l.reshape(bsz, src_len, self.embed_dim)
244
+
245
+ attn_output_v = self.out_v_proj(attn_output_v)
246
+ attn_output_l = self.out_l_proj(attn_output_l)
247
+
248
+ return attn_output_v, attn_output_l
249
+
250
+
251
+ # Bi-Direction MHA (text->image, image->text)
252
+ class BiAttentionBlock(nn.Module):
253
+ def __init__(
254
+ self,
255
+ v_dim,
256
+ l_dim,
257
+ embed_dim,
258
+ num_heads,
259
+ dropout=0.1,
260
+ drop_path=0.0,
261
+ init_values=1e-4,
262
+ cfg=None,
263
+ ):
264
+ """
265
+ Inputs:
266
+ embed_dim - Dimensionality of input and attention feature vectors
267
+ hidden_dim - Dimensionality of hidden layer in feed-forward network
268
+ (usually 2-4x larger than embed_dim)
269
+ num_heads - Number of heads to use in the Multi-Head Attention block
270
+ dropout - Amount of dropout to apply in the feed-forward network
271
+ """
272
+ super(BiAttentionBlock, self).__init__()
273
+
274
+ # pre layer norm
275
+ self.layer_norm_v = nn.LayerNorm(v_dim)
276
+ self.layer_norm_l = nn.LayerNorm(l_dim)
277
+ self.attn = BiMultiHeadAttention(
278
+ v_dim=v_dim, l_dim=l_dim, embed_dim=embed_dim, num_heads=num_heads, dropout=dropout
279
+ )
280
+
281
+ # add layer scale for training stability
282
+ self.drop_path = DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
283
+ self.gamma_v = nn.Parameter(init_values * torch.ones((v_dim)), requires_grad=True)
284
+ self.gamma_l = nn.Parameter(init_values * torch.ones((l_dim)), requires_grad=True)
285
+
286
+ def forward(self, v, l, attention_mask_v=None, attention_mask_l=None):
287
+ v = self.layer_norm_v(v)
288
+ l = self.layer_norm_l(l)
289
+ delta_v, delta_l = self.attn(
290
+ v, l, attention_mask_v=attention_mask_v, attention_mask_l=attention_mask_l
291
+ )
292
+ # v, l = v + delta_v, l + delta_l
293
+ v = v + self.drop_path(self.gamma_v * delta_v)
294
+ l = l + self.drop_path(self.gamma_l * delta_l)
295
+ return v, l
296
+
297
+ # def forward(self, v:List[torch.Tensor], l, attention_mask_v=None, attention_mask_l=None)
ComfyUI/custom_nodes/comfyui_segment_anything/local_groundingdino/models/GroundingDINO/groundingdino.py ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------------------
2
+ # Grounding DINO
3
+ # url: https://github.com/IDEA-Research/GroundingDINO
4
+ # Copyright (c) 2023 IDEA. All Rights Reserved.
5
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
6
+ # ------------------------------------------------------------------------
7
+ # Conditional DETR model and criterion classes.
8
+ # Copyright (c) 2021 Microsoft. All Rights Reserved.
9
+ # Licensed under the Apache License, Version 2.0 [see LICENSE for details]
10
+ # ------------------------------------------------------------------------
11
+ # Modified from DETR (https://github.com/facebookresearch/detr)
12
+ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
13
+ # ------------------------------------------------------------------------
14
+ # Modified from Deformable DETR (https://github.com/fundamentalvision/Deformable-DETR)
15
+ # Copyright (c) 2020 SenseTime. All Rights Reserved.
16
+ # ------------------------------------------------------------------------
17
+ import copy
18
+ from typing import List
19
+
20
+ import torch
21
+ import torch.nn.functional as F
22
+ from torch import nn
23
+
24
+ from local_groundingdino.util import get_tokenlizer
25
+ from local_groundingdino.util.misc import (
26
+ NestedTensor,
27
+ inverse_sigmoid,
28
+ nested_tensor_from_tensor_list,
29
+ )
30
+
31
+ from ..registry import MODULE_BUILD_FUNCS
32
+ from .backbone import build_backbone
33
+ from .bertwarper import (
34
+ BertModelWarper,
35
+ generate_masks_with_special_tokens_and_transfer_map,
36
+ )
37
+ from .transformer import build_transformer
38
+ from .utils import MLP, ContrastiveEmbed
39
+
40
+
41
+ class GroundingDINO(nn.Module):
42
+ """This is the Cross-Attention Detector module that performs object detection"""
43
+
44
+ def __init__(
45
+ self,
46
+ backbone,
47
+ transformer,
48
+ num_queries,
49
+ aux_loss=False,
50
+ iter_update=False,
51
+ query_dim=2,
52
+ num_feature_levels=1,
53
+ nheads=8,
54
+ # two stage
55
+ two_stage_type="no", # ['no', 'standard']
56
+ dec_pred_bbox_embed_share=True,
57
+ two_stage_class_embed_share=True,
58
+ two_stage_bbox_embed_share=True,
59
+ num_patterns=0,
60
+ dn_number=100,
61
+ dn_box_noise_scale=0.4,
62
+ dn_label_noise_ratio=0.5,
63
+ dn_labelbook_size=100,
64
+ text_encoder_type="bert-base-uncased",
65
+ sub_sentence_present=True,
66
+ max_text_len=256,
67
+ ):
68
+ """Initializes the model.
69
+ Parameters:
70
+ backbone: torch module of the backbone to be used. See backbone.py
71
+ transformer: torch module of the transformer architecture. See transformer.py
72
+ num_queries: number of object queries, ie detection slot. This is the maximal number of objects
73
+ Conditional DETR can detect in a single image. For COCO, we recommend 100 queries.
74
+ aux_loss: True if auxiliary decoding losses (loss at each decoder layer) are to be used.
75
+ """
76
+ super().__init__()
77
+ self.num_queries = num_queries
78
+ self.transformer = transformer
79
+ self.hidden_dim = hidden_dim = transformer.d_model
80
+ self.num_feature_levels = num_feature_levels
81
+ self.nheads = nheads
82
+ self.max_text_len = 256
83
+ self.sub_sentence_present = sub_sentence_present
84
+
85
+ # setting query dim
86
+ self.query_dim = query_dim
87
+ assert query_dim == 4
88
+
89
+ # for dn training
90
+ self.num_patterns = num_patterns
91
+ self.dn_number = dn_number
92
+ self.dn_box_noise_scale = dn_box_noise_scale
93
+ self.dn_label_noise_ratio = dn_label_noise_ratio
94
+ self.dn_labelbook_size = dn_labelbook_size
95
+
96
+ # bert
97
+ self.tokenizer = get_tokenlizer.get_tokenlizer(text_encoder_type)
98
+ self.bert = get_tokenlizer.get_pretrained_language_model(text_encoder_type)
99
+ self.bert.pooler.dense.weight.requires_grad_(False)
100
+ self.bert.pooler.dense.bias.requires_grad_(False)
101
+ self.bert = BertModelWarper(bert_model=self.bert)
102
+
103
+ self.feat_map = nn.Linear(self.bert.config.hidden_size, self.hidden_dim, bias=True)
104
+ nn.init.constant_(self.feat_map.bias.data, 0)
105
+ nn.init.xavier_uniform_(self.feat_map.weight.data)
106
+ # freeze
107
+
108
+ # special tokens
109
+ self.specical_tokens = self.tokenizer.convert_tokens_to_ids(["[CLS]", "[SEP]", ".", "?"])
110
+
111
+ # prepare input projection layers
112
+ if num_feature_levels > 1:
113
+ num_backbone_outs = len(backbone.num_channels)
114
+ input_proj_list = []
115
+ for _ in range(num_backbone_outs):
116
+ in_channels = backbone.num_channels[_]
117
+ input_proj_list.append(
118
+ nn.Sequential(
119
+ nn.Conv2d(in_channels, hidden_dim, kernel_size=1),
120
+ nn.GroupNorm(32, hidden_dim),
121
+ )
122
+ )
123
+ for _ in range(num_feature_levels - num_backbone_outs):
124
+ input_proj_list.append(
125
+ nn.Sequential(
126
+ nn.Conv2d(in_channels, hidden_dim, kernel_size=3, stride=2, padding=1),
127
+ nn.GroupNorm(32, hidden_dim),
128
+ )
129
+ )
130
+ in_channels = hidden_dim
131
+ self.input_proj = nn.ModuleList(input_proj_list)
132
+ else:
133
+ assert two_stage_type == "no", "two_stage_type should be no if num_feature_levels=1 !!!"
134
+ self.input_proj = nn.ModuleList(
135
+ [
136
+ nn.Sequential(
137
+ nn.Conv2d(backbone.num_channels[-1], hidden_dim, kernel_size=1),
138
+ nn.GroupNorm(32, hidden_dim),
139
+ )
140
+ ]
141
+ )
142
+
143
+ self.backbone = backbone
144
+ self.aux_loss = aux_loss
145
+ self.box_pred_damping = box_pred_damping = None
146
+
147
+ self.iter_update = iter_update
148
+ assert iter_update, "Why not iter_update?"
149
+
150
+ # prepare pred layers
151
+ self.dec_pred_bbox_embed_share = dec_pred_bbox_embed_share
152
+ # prepare class & box embed
153
+ _class_embed = ContrastiveEmbed()
154
+
155
+ _bbox_embed = MLP(hidden_dim, hidden_dim, 4, 3)
156
+ nn.init.constant_(_bbox_embed.layers[-1].weight.data, 0)
157
+ nn.init.constant_(_bbox_embed.layers[-1].bias.data, 0)
158
+
159
+ if dec_pred_bbox_embed_share:
160
+ box_embed_layerlist = [_bbox_embed for i in range(transformer.num_decoder_layers)]
161
+ else:
162
+ box_embed_layerlist = [
163
+ copy.deepcopy(_bbox_embed) for i in range(transformer.num_decoder_layers)
164
+ ]
165
+ class_embed_layerlist = [_class_embed for i in range(transformer.num_decoder_layers)]
166
+ self.bbox_embed = nn.ModuleList(box_embed_layerlist)
167
+ self.class_embed = nn.ModuleList(class_embed_layerlist)
168
+ self.transformer.decoder.bbox_embed = self.bbox_embed
169
+ self.transformer.decoder.class_embed = self.class_embed
170
+
171
+ # two stage
172
+ self.two_stage_type = two_stage_type
173
+ assert two_stage_type in ["no", "standard"], "unknown param {} of two_stage_type".format(
174
+ two_stage_type
175
+ )
176
+ if two_stage_type != "no":
177
+ if two_stage_bbox_embed_share:
178
+ assert dec_pred_bbox_embed_share
179
+ self.transformer.enc_out_bbox_embed = _bbox_embed
180
+ else:
181
+ self.transformer.enc_out_bbox_embed = copy.deepcopy(_bbox_embed)
182
+
183
+ if two_stage_class_embed_share:
184
+ assert dec_pred_bbox_embed_share
185
+ self.transformer.enc_out_class_embed = _class_embed
186
+ else:
187
+ self.transformer.enc_out_class_embed = copy.deepcopy(_class_embed)
188
+
189
+ self.refpoint_embed = None
190
+
191
+ self._reset_parameters()
192
+
193
+ def _reset_parameters(self):
194
+ # init input_proj
195
+ for proj in self.input_proj:
196
+ nn.init.xavier_uniform_(proj[0].weight, gain=1)
197
+ nn.init.constant_(proj[0].bias, 0)
198
+
199
+ def init_ref_points(self, use_num_queries):
200
+ self.refpoint_embed = nn.Embedding(use_num_queries, self.query_dim)
201
+
202
+ def forward(self, samples: NestedTensor, targets: List = None, **kw):
203
+ """The forward expects a NestedTensor, which consists of:
204
+ - samples.tensor: batched images, of shape [batch_size x 3 x H x W]
205
+ - samples.mask: a binary mask of shape [batch_size x H x W], containing 1 on padded pixels
206
+
207
+ It returns a dict with the following elements:
208
+ - "pred_logits": the classification logits (including no-object) for all queries.
209
+ Shape= [batch_size x num_queries x num_classes]
210
+ - "pred_boxes": The normalized boxes coordinates for all queries, represented as
211
+ (center_x, center_y, width, height). These values are normalized in [0, 1],
212
+ relative to the size of each individual image (disregarding possible padding).
213
+ See PostProcess for information on how to retrieve the unnormalized bounding box.
214
+ - "aux_outputs": Optional, only returned when auxilary losses are activated. It is a list of
215
+ dictionnaries containing the two above keys for each decoder layer.
216
+ """
217
+ if targets is None:
218
+ captions = kw["captions"]
219
+ else:
220
+ captions = [t["caption"] for t in targets]
221
+ len(captions)
222
+
223
+ # encoder texts
224
+ tokenized = self.tokenizer(captions, padding="longest", return_tensors="pt").to(
225
+ samples.device
226
+ )
227
+ (
228
+ text_self_attention_masks,
229
+ position_ids,
230
+ cate_to_token_mask_list,
231
+ ) = generate_masks_with_special_tokens_and_transfer_map(
232
+ tokenized, self.specical_tokens, self.tokenizer
233
+ )
234
+
235
+ if text_self_attention_masks.shape[1] > self.max_text_len:
236
+ text_self_attention_masks = text_self_attention_masks[
237
+ :, : self.max_text_len, : self.max_text_len
238
+ ]
239
+ position_ids = position_ids[:, : self.max_text_len]
240
+ tokenized["input_ids"] = tokenized["input_ids"][:, : self.max_text_len]
241
+ tokenized["attention_mask"] = tokenized["attention_mask"][:, : self.max_text_len]
242
+ tokenized["token_type_ids"] = tokenized["token_type_ids"][:, : self.max_text_len]
243
+
244
+ # extract text embeddings
245
+ if self.sub_sentence_present:
246
+ tokenized_for_encoder = {k: v for k, v in tokenized.items() if k != "attention_mask"}
247
+ tokenized_for_encoder["attention_mask"] = text_self_attention_masks
248
+ tokenized_for_encoder["position_ids"] = position_ids
249
+ else:
250
+ # import ipdb; ipdb.set_trace()
251
+ tokenized_for_encoder = tokenized
252
+
253
+ bert_output = self.bert(**tokenized_for_encoder) # bs, 195, 768
254
+
255
+ encoded_text = self.feat_map(bert_output["last_hidden_state"]) # bs, 195, d_model
256
+ text_token_mask = tokenized.attention_mask.bool() # bs, 195
257
+ # text_token_mask: True for nomask, False for mask
258
+ # text_self_attention_masks: True for nomask, False for mask
259
+
260
+ if encoded_text.shape[1] > self.max_text_len:
261
+ encoded_text = encoded_text[:, : self.max_text_len, :]
262
+ text_token_mask = text_token_mask[:, : self.max_text_len]
263
+ position_ids = position_ids[:, : self.max_text_len]
264
+ text_self_attention_masks = text_self_attention_masks[
265
+ :, : self.max_text_len, : self.max_text_len
266
+ ]
267
+
268
+ text_dict = {
269
+ "encoded_text": encoded_text, # bs, 195, d_model
270
+ "text_token_mask": text_token_mask, # bs, 195
271
+ "position_ids": position_ids, # bs, 195
272
+ "text_self_attention_masks": text_self_attention_masks, # bs, 195,195
273
+ }
274
+
275
+ # import ipdb; ipdb.set_trace()
276
+
277
+ if isinstance(samples, (list, torch.Tensor)):
278
+ samples = nested_tensor_from_tensor_list(samples)
279
+ features, poss = self.backbone(samples)
280
+
281
+ srcs = []
282
+ masks = []
283
+ for l, feat in enumerate(features):
284
+ src, mask = feat.decompose()
285
+ srcs.append(self.input_proj[l](src))
286
+ masks.append(mask)
287
+ assert mask is not None
288
+ if self.num_feature_levels > len(srcs):
289
+ _len_srcs = len(srcs)
290
+ for l in range(_len_srcs, self.num_feature_levels):
291
+ if l == _len_srcs:
292
+ src = self.input_proj[l](features[-1].tensors)
293
+ else:
294
+ src = self.input_proj[l](srcs[-1])
295
+ m = samples.mask
296
+ mask = F.interpolate(m[None].float(), size=src.shape[-2:]).to(torch.bool)[0]
297
+ pos_l = self.backbone[1](NestedTensor(src, mask)).to(src.dtype)
298
+ srcs.append(src)
299
+ masks.append(mask)
300
+ poss.append(pos_l)
301
+
302
+ input_query_bbox = input_query_label = attn_mask = dn_meta = None
303
+ hs, reference, hs_enc, ref_enc, init_box_proposal = self.transformer(
304
+ srcs, masks, input_query_bbox, poss, input_query_label, attn_mask, text_dict
305
+ )
306
+
307
+ # deformable-detr-like anchor update
308
+ outputs_coord_list = []
309
+ for dec_lid, (layer_ref_sig, layer_bbox_embed, layer_hs) in enumerate(
310
+ zip(reference[:-1], self.bbox_embed, hs)
311
+ ):
312
+ layer_delta_unsig = layer_bbox_embed(layer_hs)
313
+ layer_outputs_unsig = layer_delta_unsig + inverse_sigmoid(layer_ref_sig)
314
+ layer_outputs_unsig = layer_outputs_unsig.sigmoid()
315
+ outputs_coord_list.append(layer_outputs_unsig)
316
+ outputs_coord_list = torch.stack(outputs_coord_list)
317
+
318
+ # output
319
+ outputs_class = torch.stack(
320
+ [
321
+ layer_cls_embed(layer_hs, text_dict)
322
+ for layer_cls_embed, layer_hs in zip(self.class_embed, hs)
323
+ ]
324
+ )
325
+ out = {"pred_logits": outputs_class[-1], "pred_boxes": outputs_coord_list[-1]}
326
+
327
+ # # for intermediate outputs
328
+ # if self.aux_loss:
329
+ # out['aux_outputs'] = self._set_aux_loss(outputs_class, outputs_coord_list)
330
+
331
+ # # for encoder output
332
+ # if hs_enc is not None:
333
+ # # prepare intermediate outputs
334
+ # interm_coord = ref_enc[-1]
335
+ # interm_class = self.transformer.enc_out_class_embed(hs_enc[-1], text_dict)
336
+ # out['interm_outputs'] = {'pred_logits': interm_class, 'pred_boxes': interm_coord}
337
+ # out['interm_outputs_for_matching_pre'] = {'pred_logits': interm_class, 'pred_boxes': init_box_proposal}
338
+
339
+ return out
340
+
341
+ @torch.jit.unused
342
+ def _set_aux_loss(self, outputs_class, outputs_coord):
343
+ # this is a workaround to make torchscript happy, as torchscript
344
+ # doesn't support dictionary with non-homogeneous values, such
345
+ # as a dict having both a Tensor and a list.
346
+ return [
347
+ {"pred_logits": a, "pred_boxes": b}
348
+ for a, b in zip(outputs_class[:-1], outputs_coord[:-1])
349
+ ]
350
+
351
+
352
+ @MODULE_BUILD_FUNCS.registe_with_name(module_name="groundingdino")
353
+ def build_groundingdino(args):
354
+
355
+ backbone = build_backbone(args)
356
+ transformer = build_transformer(args)
357
+
358
+ dn_labelbook_size = args.dn_labelbook_size
359
+ dec_pred_bbox_embed_share = args.dec_pred_bbox_embed_share
360
+ sub_sentence_present = args.sub_sentence_present
361
+
362
+ model = GroundingDINO(
363
+ backbone,
364
+ transformer,
365
+ num_queries=args.num_queries,
366
+ aux_loss=True,
367
+ iter_update=True,
368
+ query_dim=4,
369
+ num_feature_levels=args.num_feature_levels,
370
+ nheads=args.nheads,
371
+ dec_pred_bbox_embed_share=dec_pred_bbox_embed_share,
372
+ two_stage_type=args.two_stage_type,
373
+ two_stage_bbox_embed_share=args.two_stage_bbox_embed_share,
374
+ two_stage_class_embed_share=args.two_stage_class_embed_share,
375
+ num_patterns=args.num_patterns,
376
+ dn_number=0,
377
+ dn_box_noise_scale=args.dn_box_noise_scale,
378
+ dn_label_noise_ratio=args.dn_label_noise_ratio,
379
+ dn_labelbook_size=dn_labelbook_size,
380
+ text_encoder_type=args.text_encoder_type,
381
+ sub_sentence_present=sub_sentence_present,
382
+ max_text_len=args.max_text_len,
383
+ )
384
+
385
+ return model