Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
faaany committed Jun 6, 2024
1 parent e17c29d commit 56feb0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions optimum/exporters/ipex/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,12 @@ def forward(
kv_seq_len = seq_len + past_key_value[0].size(-2) if past_key_value is not None else seq_len

query, key, value = self.qkv_gemm(hidden_states)
query, key = self.rope(query, key, kv_seq_len, position_ids, use_cache, position_ids)
query, key = self.rope(query, key, kv_seq_len, position_ids, use_cache)

sdpa = self.sdpa_with_cache if use_cache else self.sdpa_without_cache
attn_output, past_key_value, attn_weights = sdpa(query, key, value, past_key_value, attention_mask)
attn_output, past_key_value, attn_weights = sdpa(
query, key, value, past_key_value, attention_mask, position_ids
)
attn_output = attn_output.transpose(1, 2).reshape(bsz, seq_len, self.hidden_size)

if hasattr(self, "mha_linear_add"):
Expand Down

0 comments on commit 56feb0e

Please sign in to comment.