Skip to content

Commit

Permalink
optimize Minicpm (intel-analytics#11189)
Browse files Browse the repository at this point in the history
* minicpm optimize

* update
  • Loading branch information
qiuxin2012 authored Jun 3, 2024
1 parent ff83fad commit 5f13700
Show file tree
Hide file tree
Showing 2 changed files with 380 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/llm/src/ipex_llm/transformers/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1598,4 +1598,18 @@ def safe_bmm_fwd(*args, **kwargs):
module.StableLmModel,
stablelm_model_forward
)
elif model.config.model_type == 'minicpm':
from ipex_llm.transformers.models.minicpm import minicpm_attention_forward
modeling_module_name = model.__class__.__module__
module = importlib.import_module(modeling_module_name)
convert_forward(model,
module.MiniCPMMLP,
llama_mlp_forward)
convert_forward(model,
module.MiniCPMRMSNorm,
llama_rms_norm_forward)
convert_forward(model,
module.MiniCPMAttention,
minicpm_attention_forward)

return model
Loading

0 comments on commit 5f13700

Please sign in to comment.