Skip to content

VLLM offline inference raise except when using qianfan-vl #25793

@cqray1990

Description

@cqray1990

Your current environment

vllm 0.10.2
transformers 4.56.2

🐛 Describe the bug

                        global llm, processor
                        #engine_args
                        llm = LLM(
                            model=./Qianfan-VL-8B",
                            trust_remote_code=True,
                            dtype="float16",
                            tensor_parallel_size=1, 
                            enforce_eager=True, 
                            gpu_memory_utilization=0.9, 
                            hf_overrides={"architectures":["InternVLChatModel"],"model_type":"internvl_chat"}
                        )
                        
                        # 初始化处理器
                        processor = AutoProcessor.from_pretrained("./Qianfan-VL-8B", trust_remote_code=True)
                        
                        print("✅ 模型加载完成")
                        def call_local_llm(imgpath,text):
                            pil_image = Image.open(imgpath)
                            messages = [
                                {
                                    "role": "user",
                                    "content": [
                                        {
                                            "type": "image",
                                             "image": pil_image
                                        },
                                        {
                                            "type": "text",
                                            "text": text
                                        }
                        
                                    ]
                                }
                            ]
                        
                            prompts = processor.apply_chat_template(messages,tokenize=False) 
                        
                            sampling_params = SamplingParams(
                                n=1,
                                best_of=1,
                                presence_penalty=0.0,
                                frequency_penalty=0.0,
                                temperature=0,
                                #top_p=request.top_p,
                                #top_k=request.top_k,
                                max_tokens=512,
                               # stop=request.stop or []
                            )
                        
                            outputs = llm.generate(
                                {
                                    "prompt": prompts,
                                    "multi_modal_data": {"image": pil_image},
                                },
                                sampling_params=sampling_params,
                            )
                        
                            print("-" * 50)
                            for o in outputs:
                                generated_text = o.outputs[0].text
                                print(generated_text)
                                print("-" * 50)
                        
                        
                        call_local_llm("./test.jpg","Please recognize all text in the image")

错误如下:
ile vllm/multimodal/processing.py", line 1817, in apply
prompt_ids, prompt, mm_placeholders = self._maybe_apply_prompt_updates(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vllm/multimodal/processing.py", line 1769, in _maybe_apply_prompt_updates
) = self._apply_prompt_updates(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "vllm/multimodal/processing.py", line 1691, in _apply_prompt_updates
assert update_idx is not None, (
^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Failed to apply prompt replacement for mm_items['image'][0]

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions