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

Function bert_position_ids

DeepSpeedExample/megatron/model/bert_model.py:51–58  ·  view source on GitHub ↗
(token_ids)

Source from the content-addressed store, hash-verified

49 return extended_attention_mask
50
51def bert_position_ids(token_ids):
52 # Create position ids
53 seq_length = token_ids.size(1)
54 position_ids = torch.arange(seq_length, dtype=torch.long,
55 device=token_ids.device)
56 position_ids = position_ids.unsqueeze(0).expand_as(token_ids)
57
58 return position_ids
59
60
61class BertLMHead(MegatronModule):

Callers 4

forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected