MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / scaled_init_method_normal

Function scaled_init_method_normal

codegeex/megatron/model/utils.py:31–38  ·  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

29
30
31def scaled_init_method_normal(sigma, num_layers):
32 """Init method based on N(0, sigma/sqrt(2*num_layers)."""
33 std = sigma / math.sqrt(2.0 * num_layers)
34
35 def init_(tensor):
36 return torch.nn.init.normal_(tensor, mean=0.0, std=std)
37
38 return init_
39
40
41def attention_mask_func(attention_scores, attention_mask):

Callers 3

__init__Method · 0.90
__init__Method · 0.90
get_language_modelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected