| 682 | return x |
| 683 | |
| 684 | def init_weights(self): |
| 685 | # basic init |
| 686 | for m in self.modules(): |
| 687 | if isinstance(m, nn.Linear): |
| 688 | nn.init.xavier_uniform_(m.weight) |
| 689 | if m.bias is not None: |
| 690 | nn.init.zeros_(m.bias) |
| 691 | |
| 692 | # init embeddings |
| 693 | # nn.init.xavier_uniform_(self.patch_embedding.weight.flatten(1)) |
| 694 | for m in self.text_embedding.modules(): |
| 695 | if isinstance(m, nn.Linear): |
| 696 | nn.init.normal_(m.weight, std=.02) |
| 697 | for m in self.time_embedding.modules(): |
| 698 | if isinstance(m, nn.Linear): |
| 699 | nn.init.normal_(m.weight, std=.02) |
| 700 | |
| 701 | # init output layer |
| 702 | # nn.init.zeros_(self.motion_head.head.weight) |
| 703 | |
| 704 | @staticmethod |
| 705 | def state_dict_converter(): |