Skip to content

Commit

Permalink
small fix (#12616)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored Dec 26, 2024
1 parent d841e1d commit 1604b4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions python/llm/src/ipex_llm/transformers/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,9 +1784,6 @@ def _optimize_post(model, lightweight_bmm=False):
convert_forward(model,
module.CohereAttention,
cohere_attention_forward)
convert_forward(model,
module.CohereLayerNorm,
rms_norm_forward)
convert_forward(model,
module.CohereMLP,
mlp_silu_forward)
Expand Down
6 changes: 3 additions & 3 deletions python/llm/src/ipex_llm/transformers/models/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ def llama_attention_forward(

if query_states.device.type == "xpu":
import xe_addons
if position_embeddings is None:
# transformers < 4.43
if hasattr(self, "rotary_emb"):
# transformers < 4.46
xe_addons.rotary_half_inplaced(self.rotary_emb.inv_freq, position_ids,
query_states, key_states)
else:
# transformers >= 4.43
# transformers >= 4.46
cos, sin = position_embeddings
make_cache_contiguous_inplaced(cos, sin)
xe_addons.rotary_half_with_cache_inplaced(query_states, key_states, cos, sin)
Expand Down

0 comments on commit 1604b4e

Please sign in to comment.