Skip to content

Commit

Permalink
fix phi-2 and phi-3 convert (#11116)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored May 23, 2024
1 parent 37b98a5 commit 797dbc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/llm/src/ipex_llm/transformers/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,15 +1522,15 @@ def safe_bmm_fwd(*args, **kwargs):
from ipex_llm.transformers.models.starcoder2 import model_forward
convert_forward(model, module.Starcoder2Attention, attention_forward)
convert_forward(model, module.Starcoder2Model, model_forward)
elif model.config.model_type in ["phi3", "phi3_v"]:
elif model.config.model_type == "phi":
# for phi-2
modeling_module_name = model.__class__.__module__
module = importlib.import_module(modeling_module_name)
from ipex_llm.transformers.models.phi import attention_forward
from ipex_llm.transformers.models.phi import model_forward
convert_forward(model, module.PhiAttention, attention_forward)
convert_forward(model, module.PhiModel, model_forward)
elif model.config.model_type == "phi3":
elif model.config.model_type in ["phi3", "phi3_v"]:
# for phi-3
modeling_module_name = model.__class__.__module__
module = importlib.import_module(modeling_module_name)
Expand Down

0 comments on commit 797dbc4

Please sign in to comment.