diff --git a/optimum/exporters/ipex/modeling_utils.py b/optimum/exporters/ipex/modeling_utils.py index b6540a78e7..cdb7750c13 100644 --- a/optimum/exporters/ipex/modeling_utils.py +++ b/optimum/exporters/ipex/modeling_utils.py @@ -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"):