fix bug with batched weights

This commit is contained in:
matt3o
2024-04-23 09:17:56 +02:00
parent e020ca0c78
commit fef59c5b7f
2 changed files with 41 additions and 66 deletions
+7 -4
View File
@@ -656,13 +656,16 @@ class IPAdapterAdvanced:
image_composition = image_style
weight_type = "strong style and composition" if expand_style else "style and composition"
elif ipadapter_params is not None: # we are doing batch processing
if ipadapter_params is not None: # we are doing batch processing
image = ipadapter_params['image']
attn_mask = ipadapter_params['attn_mask']
weight = ipadapter_params['weight']
weight_type = ipadapter_params['weight_type']
start_at = ipadapter_params['start_at']
end_at = ipadapter_params['end_at']
else:
# at this point weight can be a list from the batch-weight or a single float
weight = [weight]
image = image if isinstance(image, list) else [image]
@@ -676,7 +679,7 @@ class IPAdapterAdvanced:
"image": image[i],
"image_composition": image_composition,
"image_negative": image_negative,
"weight": weight if not isinstance(weight, list) else weight[i],
"weight": weight[i],
"weight_composition": weight_composition,
"weight_faceidv2": weight_faceidv2,
"weight_type": weight_type if not isinstance(weight_type, list) else weight_type[i],
@@ -690,10 +693,10 @@ class IPAdapterAdvanced:
"layer_weights": layer_weights,
}
work_model, image = ipadapter_execute(work_model, ipadapter_model, clip_vision, **ipa_args)
work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, **ipa_args)
del ipadapter
return (work_model, image, )
return (work_model, face_image, )
class IPAdapterBatch(IPAdapterAdvanced):
def __init__(self):
+34 -62
View File
@@ -1,6 +1,6 @@
{
"last_node_id": 23,
"last_link_id": 43,
"last_link_id": 44,
"nodes": [
{
"id": 8,
@@ -14,7 +14,7 @@
"1": 46
},
"flags": {},
"order": 11,
"order": 10,
"mode": 0,
"inputs": [
{
@@ -87,7 +87,7 @@
"1": 262
},
"flags": {},
"order": 10,
"order": 9,
"mode": 0,
"inputs": [
{
@@ -146,7 +146,7 @@
"1": 582.3048095703125
},
"flags": {},
"order": 12,
"order": 11,
"mode": 0,
"inputs": [
{
@@ -211,7 +211,7 @@
"1": 180.6060791015625
},
"flags": {},
"order": 6,
"order": 5,
"mode": 0,
"inputs": [
{
@@ -249,7 +249,7 @@
"1": 164.31304931640625
},
"flags": {},
"order": 5,
"order": 4,
"mode": 0,
"inputs": [
{
@@ -335,7 +335,7 @@
"1": 126
},
"flags": {},
"order": 4,
"order": 3,
"mode": 0,
"inputs": [
{
@@ -391,7 +391,7 @@
"1": 78
},
"flags": {},
"order": 8,
"order": 7,
"mode": 0,
"inputs": [
{
@@ -440,10 +440,10 @@
],
"size": {
"0": 315,
"1": 166
"1": 190
},
"flags": {},
"order": 9,
"order": 8,
"mode": 0,
"inputs": [
{
@@ -460,7 +460,7 @@
{
"name": "image",
"type": "IMAGE",
"link": 41
"link": 44
},
{
"name": "attn_mask",
@@ -485,7 +485,8 @@
"widgets_values": [
0.4,
0,
1
1,
"standard"
]
},
{
@@ -497,10 +498,10 @@
],
"size": {
"0": 315,
"1": 298
"1": 322
},
"flags": {},
"order": 7,
"order": 6,
"mode": 0,
"inputs": [
{
@@ -549,6 +550,15 @@
],
"shape": 3,
"slot_index": 0
},
{
"name": "face_image",
"type": "IMAGE",
"links": [
44
],
"shape": 3,
"slot_index": 1
}
],
"properties": {
@@ -560,46 +570,8 @@
"linear",
"concat",
0,
1
]
},
{
"id": 23,
"type": "LoadImage",
"pos": [
1280,
-230
],
"size": {
"0": 315,
"1": 314
},
"flags": {},
"order": 3,
"mode": 0,
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
41
],
"shape": 3,
"slot_index": 0
},
{
"name": "MASK",
"type": "MASK",
"links": null,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"rosario.png",
"image"
1,
"V only"
]
}
],
@@ -724,14 +696,6 @@
0,
"MODEL"
],
[
41,
23,
0,
21,
2,
"IMAGE"
],
[
42,
21,
@@ -747,6 +711,14 @@
22,
0,
"MODEL"
],
[
44,
18,
1,
21,
2,
"IMAGE"
]
],
"groups": [],