Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/mcore_bridge/model/gpt_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,11 @@ def _get_rotary_pos_emb(self, decoder_input, position_ids, packed_seq_params, in
assert (inference_context.is_static_batching()
), 'GPTModel currently only supports static inference batching.'
# Flash decoding uses precomputed cos and sin for RoPE
rotary_pos_cos, rotary_pos_sin = self.rotary_pos_emb_cache.setdefault(
inference_context.max_sequence_length,
self.rotary_pos_emb.get_cos_sin(inference_context.max_sequence_length),
)
max_sequence_length = inference_context.max_sequence_length
if max_sequence_length not in self.rotary_pos_emb_cache:
self.rotary_pos_emb_cache[max_sequence_length] = self.rotary_pos_emb.get_cos_sin(
max_sequence_length)
rotary_pos_cos, rotary_pos_sin = self.rotary_pos_emb_cache[max_sequence_length]
else:
rotary_seq_len = RotaryEmbedding.get_rotary_seq_len(self, inference_context, self.decoder,
decoder_input, self.config, packed_seq_params)
Expand Down
Loading