MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / _init_weights

Method _init_weights

vtp/models/vtp_hf/modeling_vtp.py:38–48  ·  view source on GitHub ↗

Initialize weights following VTP conventions.

(self, module)

Source from the content-addressed store, hash-verified

36 supports_gradient_checkpointing = True
37
38 def _init_weights(self, module):
39 """Initialize weights following VTP conventions."""
40 if isinstance(module, nn.Linear):
41 nn.init.trunc_normal_(module.weight, std=0.02)
42 if module.bias is not None:
43 nn.init.zeros_(module.bias)
44 elif isinstance(module, nn.LayerNorm):
45 nn.init.ones_(module.weight)
46 nn.init.zeros_(module.bias)
47 elif isinstance(module, nn.Embedding):
48 nn.init.normal_(module.weight, std=0.02)
49
50
51class VTPModel(VTPPreTrainedModel):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected