MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / interact_with_ipadapter

Function interact_with_ipadapter

diffsynth/models/flux_dit.py:7–12  ·  view source on GitHub ↗
(hidden_states, q, ip_k, ip_v, scale=1.0)

Source from the content-addressed store, hash-verified

5from .utils import init_weights_on_device
6
7def interact_with_ipadapter(hidden_states, q, ip_k, ip_v, scale=1.0):
8 batch_size, num_tokens = hidden_states.shape[0:2]
9 ip_hidden_states = torch.nn.functional.scaled_dot_product_attention(q, ip_k, ip_v)
10 ip_hidden_states = ip_hidden_states.transpose(1, 2).reshape(batch_size, num_tokens, -1)
11 hidden_states = hidden_states + scale * ip_hidden_states
12 return hidden_states
13
14
15class RoPEEmbedding(torch.nn.Module):

Callers 2

forwardMethod · 0.85
process_attentionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected