From 065fe68bdade489b9bb648c6a08bd1bf25d125ff Mon Sep 17 00:00:00 2001 From: Yishuo Wang Date: Fri, 10 Jan 2025 10:12:49 +0800 Subject: [PATCH] fix user issue --- python/llm/src/ipex_llm/transformers/convert_ipex.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/llm/src/ipex_llm/transformers/convert_ipex.py b/python/llm/src/ipex_llm/transformers/convert_ipex.py index b36d75fee3f..bf61cdad91a 100644 --- a/python/llm/src/ipex_llm/transformers/convert_ipex.py +++ b/python/llm/src/ipex_llm/transformers/convert_ipex.py @@ -52,7 +52,14 @@ def _ipex_optimize_rmsnorm(_model, supported_classes, is_tpp=False, is_woq=False): - from intel_extension_for_pytorch.transformers.models.cpu.fusions.mha_fusion import _IPEXRMSNorm + try: + # old version use name `_IPEXRMSNorm` + from intel_extension_for_pytorch.transformers.models.cpu.fusions.mha_fusion \ + import _IPEXRMSNorm + except ImportError: + # new version use name `_IPEXRMSNormCPU` + from intel_extension_for_pytorch.transformers.models.cpu.fusions.mha_fusion \ + import _IPEXRMSNormCPU as _IPEXRMSNorm for supported_class in supported_classes: lowering_class_cpu( _model,