From 8292fd92628730424fa1bcf2c5a2a40d5485fc56 Mon Sep 17 00:00:00 2001 From: suluyan Date: Fri, 21 Mar 2025 11:33:46 +0800 Subject: [PATCH] fix pipeline builder --- modelscope/utils/hf_util/patcher.py | 1 - tests/pipelines/test_llm_pipeline.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modelscope/utils/hf_util/patcher.py b/modelscope/utils/hf_util/patcher.py index 02afb758..70c52ee1 100644 --- a/modelscope/utils/hf_util/patcher.py +++ b/modelscope/utils/hf_util/patcher.py @@ -28,7 +28,6 @@ def get_all_imported_modules(): 'Auto.*', 'T5.*', 'BitsAndBytesConfig', 'GenerationConfig', 'Awq.*', 'GPTQ.*', 'BatchFeature', 'Qwen.*', 'Llama.*', 'PretrainedConfig', 'PreTrainedTokenizer', 'PreTrainedModel', 'PreTrainedTokenizerFast', - 'Pipeline' ] peft_include_names = ['.*PeftModel.*', '.*Config'] diffusers_include_names = [ diff --git a/tests/pipelines/test_llm_pipeline.py b/tests/pipelines/test_llm_pipeline.py index 71f02808..66b96a16 100644 --- a/tests/pipelines/test_llm_pipeline.py +++ b/tests/pipelines/test_llm_pipeline.py @@ -174,6 +174,18 @@ class LLMPipelineTest(unittest.TestCase): print('messages: ', pipe(self.messages_en, **self.gen_cfg)) print('prompt: ', pipe(self.prompt_en, **self.gen_cfg)) + @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') + def test_qwen2(self): + pipe = pipeline( + task='chat', + model='qwen/Qwen2-0.5B-Instruct', + model_revision='master', + llm_first=True, + torch_dtype='torch.float16', + device_map='auto') + print('messages: ', pipe(self.messages_en, **self.gen_cfg)) + print('prompt: ', pipe(self.prompt_en, **self.gen_cfg)) + @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') def test_llama2chat(self): pipe = pipeline(