MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / _init_weights

Method _init_weights

eval/utils/utils_odyssey/visual.py:130–137  ·  view source on GitHub ↗
(self, m)

Source from the content-addressed store, hash-verified

128 # self.apply(self._init_weights)
129
130 def _init_weights(self, m):
131 if isinstance(m, nn.Linear):
132 trunc_normal_(m.weight, std=.02)
133 if isinstance(m, nn.Linear) and m.bias is not None:
134 nn.init.constant_(m.bias, 0)
135 elif isinstance(m, nn.LayerNorm):
136 nn.init.constant_(m.bias, 0)
137 nn.init.constant_(m.weight, 1.0)
138
139 def forward(self, x, attn_mask=None):
140

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected