mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
cleanup: better var names for the ip adapter weight collection block
This commit is contained in:
parent
b39ce642b6
commit
7ee3fef2db
@ -33,25 +33,24 @@ class UNetAttentionPatcher:
|
|||||||
# "attn1" processors do not use IP-Adapters.
|
# "attn1" processors do not use IP-Adapters.
|
||||||
attn_procs[name] = CustomAttnProcessor2_0()
|
attn_procs[name] = CustomAttnProcessor2_0()
|
||||||
else:
|
else:
|
||||||
total_ip_adapter_attention_weights: list[IPAdapterAttentionWeights] = []
|
# Collect the weights from each IP Adapter for the idx'th attention processor.
|
||||||
|
ip_adapter_attention_weights_collection: list[IPAdapterAttentionWeights] = []
|
||||||
|
|
||||||
for ip_adapter in self._ip_adapters:
|
for ip_adapter in self._ip_adapters:
|
||||||
ip_adapter_attention_weights: IPAdapterAttentionWeights = IPAdapterAttentionWeights(
|
ip_adapter_attention_weights: IPAdapterAttentionWeights = IPAdapterAttentionWeights(
|
||||||
ip_adapter_weights=None, skip=False
|
ip_adapter_weights=None, skip=False
|
||||||
)
|
)
|
||||||
ip_adapter_weight = ip_adapter["ip_adapter"].attn_weights.get_attention_processor_weights(idx)
|
ip_adapter_weights = ip_adapter["ip_adapter"].attn_weights.get_attention_processor_weights(idx)
|
||||||
skip = True
|
skip = True
|
||||||
for block in ip_adapter["target_blocks"]:
|
for block in ip_adapter["target_blocks"]:
|
||||||
if block in name:
|
if block in name:
|
||||||
skip = False
|
skip = False
|
||||||
break
|
break
|
||||||
ip_adapter_attention_weights.ip_adapter_weights = ip_adapter_weight
|
ip_adapter_attention_weights.ip_adapter_weights = ip_adapter_weights
|
||||||
ip_adapter_attention_weights.skip = skip
|
ip_adapter_attention_weights.skip = skip
|
||||||
total_ip_adapter_attention_weights.append(ip_adapter_attention_weights)
|
ip_adapter_attention_weights_collection.append(ip_adapter_attention_weights)
|
||||||
|
|
||||||
# Collect the weights from each IP Adapter for the idx'th attention processor.
|
attn_procs[name] = CustomAttnProcessor2_0(ip_adapter_attention_weights_collection)
|
||||||
|
|
||||||
attn_procs[name] = CustomAttnProcessor2_0(total_ip_adapter_attention_weights)
|
|
||||||
|
|
||||||
return attn_procs
|
return attn_procs
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user