MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / init_weights

Method init_weights

models/transformer/wan/modules/t2m_model.py:684–702  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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():

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected