From cde343533e069bbb46bdb4bcf3c9ca1951591bec Mon Sep 17 00:00:00 2001 From: suluyana <110878454+suluyana@users.noreply.github.com> Date: Thu, 13 Mar 2025 15:52:34 +0800 Subject: [PATCH] fix external_engine_for_llm_checker (#1260) Co-authored-by: suluyan --- modelscope/pipelines/builder.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modelscope/pipelines/builder.py b/modelscope/pipelines/builder.py index 7e5cc6b5..5fb66178 100644 --- a/modelscope/pipelines/builder.py +++ b/modelscope/pipelines/builder.py @@ -263,13 +263,14 @@ def external_engine_for_llm_checker(model: Union[str, List[str], Model, kwargs: Dict[str, Any]) -> Optional[str]: from .nlp.llm_pipeline import ModelTypeHelper, LLMAdapterRegistry from ..hub.check_model import get_model_id_from_cache - from swift.llm import get_model_info_meta if isinstance(model, list): model = model[0] if not isinstance(model, str): model = model.model_dir - if kwargs.get('llm_framework') == 'swift': + llm_framework = kwargs.get('llm_framework', '') + if llm_framework == 'swift': + from swift.llm import get_model_info_meta # check if swift supports if os.path.exists(model): model_id = get_model_id_from_cache(model) @@ -280,9 +281,8 @@ def external_engine_for_llm_checker(model: Union[str, List[str], Model, info = get_model_info_meta(model_id) model_type = info[0].model_type except Exception as e: - logger.warning( - f'Cannot using llm_framework with {model_id}, ' - f'ignoring llm_framework={self.llm_framework} : {e}') + logger.warning(f'Cannot using llm_framework with {model_id}, ' + f'ignoring llm_framework={llm_framework} : {e}') model_type = None if model_type: return 'llm'