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

Method forward

diffsynth/models/flux_dit.py:246–259  ·  view source on GitHub ↗
(self, hidden_states_a, hidden_states_b, temb, image_rotary_emb, attn_mask=None, ipadapter_kwargs_list=None)

Source from the content-addressed store, hash-verified

244
245
246 def forward(self, hidden_states_a, hidden_states_b, temb, image_rotary_emb, attn_mask=None, ipadapter_kwargs_list=None):
247 residual = hidden_states_a
248 norm_hidden_states, gate = self.norm(hidden_states_a, emb=temb)
249 hidden_states_a = self.to_qkv_mlp(norm_hidden_states)
250 attn_output, mlp_hidden_states = hidden_states_a[:, :, :self.dim * 3], hidden_states_a[:, :, self.dim * 3:]
251
252 attn_output = self.process_attention(attn_output, image_rotary_emb, attn_mask, ipadapter_kwargs_list)
253 mlp_hidden_states = torch.nn.functional.gelu(mlp_hidden_states, approximate="tanh")
254
255 hidden_states_a = torch.cat([attn_output, mlp_hidden_states], dim=2)
256 hidden_states_a = gate.unsqueeze(1) * self.proj_out(hidden_states_a)
257 hidden_states_a = residual + hidden_states_a
258
259 return hidden_states_a, hidden_states_b
260
261
262

Callers

nothing calls this directly

Calls 3

process_attentionMethod · 0.95
normMethod · 0.80
geluMethod · 0.80

Tested by

no test coverage detected