[Fix] Resolve VLM test image placeholders from the model's own chat template (#33509)
This commit is contained in:
@@ -183,6 +183,22 @@ def download_image_with_retry(image_url: str, max_retries: int = 3) -> Image.Ima
|
||||
time.sleep(2**i)
|
||||
|
||||
|
||||
def build_vlm_image_prompt(processor, question: str) -> str:
|
||||
# Take the image placeholder from the model's own HF chat template: a
|
||||
# hand-written one silently degrades to a text-only prompt on any model
|
||||
# whose placeholder differs.
|
||||
return processor.apply_chat_template(
|
||||
[
|
||||
{
|
||||
"role": "user",
|
||||
"content": [{"type": "image"}, {"type": "text", "text": question}],
|
||||
}
|
||||
],
|
||||
tokenize=False,
|
||||
add_generation_prompt=True,
|
||||
)
|
||||
|
||||
|
||||
def is_in_ci():
|
||||
"""Return whether it is in CI runner."""
|
||||
return get_bool_env_var("SGLANG_IS_IN_CI")
|
||||
|
||||
Reference in New Issue
Block a user