Skip to content

Commit

Permalink
fix phi3 (#11729)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored Aug 7, 2024
1 parent e32d13d commit c093f7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/llm/src/ipex_llm/transformers/models/phi3.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def pre_compute_inv_freq(module: torch.nn.Module):
module.base **
(torch.arange(0, module.dim, 2, dtype=torch.int64).float() / module.dim)
)
else:
elif module.__class__.__name__ in ["Phi3SuScaledRotaryEmbedding",
"Phi3LongRoPEScaledRotaryEmbedding"]:
inv_freq_shape = torch.arange(0, module.dim, 2, dtype=torch.int64).float() / module.dim
short_ext_factors = torch.tensor(module.short_factor, dtype=torch.float32)
module.inv_freq = 1.0 / (short_ext_factors * module.base ** inv_freq_shape)
Expand Down

0 comments on commit c093f7d

Please sign in to comment.