'image_token' is undefined
#5
by
dddwzl3703
- opened
followed vLLM Installation instruction, tested with official example:
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ZJU-AI4H/Hulu-Med-32B",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'
and get:
(APIServer pid=2750956) INFO: 127.0.0.1:44528 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] An error occurred in `transformers` while applying chat template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] Traceback (most recent call last):
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/vllm/entrypoints/chat_utils.py", line 1764, in apply_hf_chat_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] return tokenizer.apply_chat_template(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/transformers/tokenization_utils_base.py", line 1667, in apply_chat_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] rendered_chat, generation_indices = render_jinja_template(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] ^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/transformers/utils/chat_template_utils.py", line 539, in render_jinja_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] rendered_chat = compiled_template.render(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] ^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] self.environment.handle_exception()
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] raise rewrite_traceback_stack(source=source)
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] File "<template>", line 29, in top-level template code
(APIServer pid=2750956) ERROR 02-06 11:03:09 [chat_utils.py:1777] jinja2.exceptions.UndefinedError: 'image_token' is undefined
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] Error in preprocessing prompt inputs
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] Traceback (most recent call last):
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/vllm/entrypoints/chat_utils.py", line 1764, in apply_hf_chat_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] return tokenizer.apply_chat_template(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/transformers/tokenization_utils_base.py", line 1667, in apply_chat_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] rendered_chat, generation_indices = render_jinja_template(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/transformers/utils/chat_template_utils.py", line 539, in render_jinja_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] rendered_chat = compiled_template.render(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] self.environment.handle_exception()
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] raise rewrite_traceback_stack(source=source)
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "<template>", line 29, in top-level template code
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] jinja2.exceptions.UndefinedError: 'image_token' is undefined
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258]
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] The above exception was the direct cause of the following exception:
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258]
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] Traceback (most recent call last):
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/vllm/entrypoints/openai/serving_chat.py", line 236, in create_chat_completion
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ) = await self._preprocess_chat(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/vllm/entrypoints/openai/serving_engine.py", line 1134, in _preprocess_chat
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] request_prompt = apply_hf_chat_template(
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] File "/home/user/workspace/vllm/.venv/lib/python3.12/site-packages/vllm/entrypoints/chat_utils.py", line 1780, in apply_hf_chat_template
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] raise ValueError(str(e)) from e
(APIServer pid=2750956) ERROR 02-06 11:03:09 [serving_chat.py:258] ValueError: 'image_token' is undefined