(
self,
hidden_states,
encoder_hidden_states=None,
attention_mask=None,
video_length=None,
)
| 233 | self.ff_norm = nn.LayerNorm(dim) |
| 234 | |
| 235 | def forward( |
| 236 | self, |
| 237 | hidden_states, |
| 238 | encoder_hidden_states=None, |
| 239 | attention_mask=None, |
| 240 | video_length=None, |
| 241 | ): |
| 242 | for attention_block, norm in zip(self.attention_blocks, self.norms): |
| 243 | norm_hidden_states = norm(hidden_states) |
| 244 | hidden_states = ( |
| 245 | attention_block( |
| 246 | norm_hidden_states, |
| 247 | encoder_hidden_states=encoder_hidden_states |
| 248 | if attention_block.is_cross_attention |
| 249 | else None, |
| 250 | video_length=video_length, |
| 251 | ) |
| 252 | + hidden_states |
| 253 | ) |
| 254 | |
| 255 | hidden_states = self.ff(self.ff_norm(hidden_states)) + hidden_states |
| 256 | |
| 257 | output = hidden_states |
| 258 | return output |
| 259 | |
| 260 | |
| 261 | class PositionalEncoding(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected