| 762 | return x |
| 763 | |
| 764 | def init_weights(self): |
| 765 | # basic init |
| 766 | for m in self.modules(): |
| 767 | if isinstance(m, nn.Linear): |
| 768 | nn.init.xavier_uniform_(m.weight) |
| 769 | if m.bias is not None: |
| 770 | nn.init.zeros_(m.bias) |
| 771 | |
| 772 | # init embeddings |
| 773 | # nn.init.xavier_uniform_(self.patch_embedding.weight.flatten(1)) |
| 774 | for m in self.text_embedding.modules(): |
| 775 | if isinstance(m, nn.Linear): |
| 776 | nn.init.normal_(m.weight, std=.02) |
| 777 | for m in self.time_embedding.modules(): |
| 778 | if isinstance(m, nn.Linear): |
| 779 | nn.init.normal_(m.weight, std=.02) |
| 780 | |
| 781 | # init output layer |
| 782 | # nn.init.zeros_(self.motion_head.head.weight) |
| 783 | |
| 784 | @staticmethod |
| 785 | def state_dict_converter(): |