MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / scaled_init_method_normal

Function scaled_init_method_normal

DeepSpeedExample/megatron/core/utils.py:164–171  ·  view source on GitHub ↗

Init method based on N(0, sigma/sqrt(2*num_layers).

(sigma, num_layers)

Source from the content-addressed store, hash-verified

162
163
164def scaled_init_method_normal(sigma, num_layers):
165 """Init method based on N(0, sigma/sqrt(2*num_layers)."""
166 std = sigma / math.sqrt(2.0 * num_layers)
167
168 def init_(tensor):
169 return torch.nn.init.normal_(tensor, mean=0.0, std=std)
170
171 return init_

Callers 1

__post_init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected