[Fix] Resolve VLM test image placeholders from the model's own chat template (#33509)

This commit is contained in:
Liangsheng Yin
2026-08-04 02:01:39 -07:00
committed by GitHub
parent 26a542722f
commit b6d548afd7
7 changed files with 110 additions and 48 deletions
@@ -1,9 +1,9 @@
import unittest
import torch
from transformers import AutoProcessor
from sglang import Engine
from sglang.lang.chat_template import get_chat_template_by_model_path
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.run_eval import run_eval
@@ -13,6 +13,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST,
CustomTestCase,
SimpleNamespace,
build_vlm_image_prompt,
is_in_amd_ci,
popen_launch_server,
)
@@ -73,8 +74,9 @@ class TestPiecewiseCudaGraphQwen25VLEmbedding(CustomTestCase):
def test_embedding(self):
model_path = "Qwen/Qwen2.5-VL-3B-Instruct"
chat_template = get_chat_template_by_model_path(model_path)
text = f"{chat_template.image_token}What is in this picture? Answer: "
text = build_vlm_image_prompt(
AutoProcessor.from_pretrained(model_path), "What is in this picture?"
)
extra_args = (
{"mem_fraction_static": AMD_MEM_FRACTION_STATIC} if is_in_amd_ci() else {}
)