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

Method __init__

DeepSpeedExample/megatron/model/gpt2_model.py:39–52  ·  view source on GitHub ↗
(self, num_tokentypes=0, parallel_output=True)

Source from the content-addressed store, hash-verified

37 """GPT-2 Language model."""
38
39 def __init__(self, num_tokentypes=0, parallel_output=True):
40 super(GPT2Model, self).__init__()
41 args = get_args()
42
43 self.parallel_output = parallel_output
44 self.fp16_lm_cross_entropy = args.fp16_lm_cross_entropy
45
46 self.language_model, self._language_model_key = get_language_model(
47 attention_mask_func=gpt2_attention_mask_func,
48 num_tokentypes=num_tokentypes,
49 add_pooler=False,
50 init_method=init_method_normal(args.init_method_std),
51 scaled_init_method=scaled_init_method_normal(args.init_method_std,
52 args.num_layers))
53
54
55 def forward(self, input_ids, position_ids, attention_mask, labels=None,

Callers

nothing calls this directly

Calls 4

get_argsFunction · 0.90
get_language_modelFunction · 0.85
init_method_normalFunction · 0.70

Tested by

no test coverage detected