| 322 | self.conv_out = torch.nn.Conv2d(320, 4, kernel_size=3, padding=1) |
| 323 | |
| 324 | def forward(self, sample, timestep, encoder_hidden_states, **kwargs): |
| 325 | # 1. time |
| 326 | time_emb = self.time_proj(timestep).to(sample.dtype) |
| 327 | time_emb = self.time_embedding(time_emb) |
| 328 | |
| 329 | # 2. pre-process |
| 330 | hidden_states = self.conv_in(sample) |
| 331 | text_emb = encoder_hidden_states |
| 332 | res_stack = [hidden_states] |
| 333 | |
| 334 | # 3. blocks |
| 335 | for i, block in enumerate(self.blocks): |
| 336 | hidden_states, time_emb, text_emb, res_stack = block(hidden_states, time_emb, text_emb, res_stack) |
| 337 | |
| 338 | # 4. output |
| 339 | hidden_states = self.conv_norm_out(hidden_states) |
| 340 | hidden_states = self.conv_act(hidden_states) |
| 341 | hidden_states = self.conv_out(hidden_states) |
| 342 | |
| 343 | return hidden_states |
| 344 | |
| 345 | @staticmethod |
| 346 | def state_dict_converter(): |