MCPcopy Create free account
hub / github.com/FunAudioLLM/FunMusic / initialize_weights

Method initialize_weights

inspiremusic/flow/decoder.py:188–200  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

186 self.initialize_weights()
187
188 def initialize_weights(self):
189 for m in self.modules():
190 if isinstance(m, nn.Conv1d):
191 nn.init.kaiming_normal_(m.weight, nonlinearity="relu")
192 if m.bias is not None:
193 nn.init.constant_(m.bias, 0)
194 elif isinstance(m, nn.GroupNorm):
195 nn.init.constant_(m.weight, 1)
196 nn.init.constant_(m.bias, 0)
197 elif isinstance(m, nn.Linear):
198 nn.init.kaiming_normal_(m.weight, nonlinearity="relu")
199 if m.bias is not None:
200 nn.init.constant_(m.bias, 0)
201
202 def forward(self, x, mask, mu, t, spks=None, cond=None):
203 """Forward pass of the UNet1DConditional model.

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected