Skip to content

Commit

Permalink
Update transformer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
StellaAthena authored Nov 27, 2023
1 parent fc214d0 commit f745997
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions megatron/model/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,13 @@ def forward(self, hidden_states, attention_mask, layer_past=None):
# full rotary
query_rot, key_rot = query_layer, key_layer

if self.bf16:
apply_rotary_fn = apply_rotary_pos_emb_torch
elif self.rope_fusion:
if self.rope_fusion:
apply_rotary_fn = fused_apply_rotary_pos_emb
else:
apply_rotary_fn = apply_rotary_pos_emb
else:
if self.bf16:
apply_rotary_fn = apply_rotary_pos_emb_torch
else:
apply_rotary_fn = apply_rotary_pos_emb

seq_len = key_layer.shape[0]
offset = 0
Expand Down

0 comments on commit f745997

Please sign in to comment.