fix bench_serving sglang backend to support image dataset (#21294)
This commit is contained in:
@@ -148,15 +148,18 @@ def create_mm_data_row(
|
|||||||
# Vision tokens = total tokens - text tokens
|
# Vision tokens = total tokens - text tokens
|
||||||
vision_prompt_len = prompt_len - text_prompt_len
|
vision_prompt_len = prompt_len - text_prompt_len
|
||||||
|
|
||||||
use_raw_prompt = backend in [
|
supported_backends = ["sglang", "sglang-native", "sglang-oai-chat"]
|
||||||
"sglang",
|
if backend not in supported_backends:
|
||||||
"sglang-oai",
|
raise ValueError(
|
||||||
"sglang-oai-chat",
|
f"Image dataset only supports backends: {supported_backends}, "
|
||||||
"vllm",
|
f"got '{backend}'."
|
||||||
"vllm-chat",
|
)
|
||||||
"lmdeploy",
|
|
||||||
"lmdeploy-chat",
|
# sglang-oai-chat: server's chat handler applies chat template, so send raw text.
|
||||||
]
|
# sglang/sglang-native: /generate does not apply chat template, so send prompt_str
|
||||||
|
# which contains image placeholder tokens needed by the multimodal processor.
|
||||||
|
use_raw_prompt = backend == "sglang-oai-chat"
|
||||||
|
|
||||||
return DatasetRow(
|
return DatasetRow(
|
||||||
prompt=text_prompt if use_raw_prompt else prompt_str,
|
prompt=text_prompt if use_raw_prompt else prompt_str,
|
||||||
prompt_len=prompt_len,
|
prompt_len=prompt_len,
|
||||||
|
|||||||
Reference in New Issue
Block a user