@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2aa5470ac5
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 09:45 UTC

[Frontend] Fix chat template content format detection (#18190)

Signed-off-by: Sebastian Schönnenbeck <sebastian.schoennenbeck@comma-soft.com>

Sebastian Schoennenbeck committed May 15, 2025 at 18:00 UTC 2aa5470ac586f1603eb9d9b30d6c41ba3b5b9cd4
1 file changed +3 -4
vllm/entrypoints/chat_utils.py
+3 -4
@@ -387,7 +387,6 @@ def resolve_hf_chat_template(
387 def _resolve_chat_template_content_format(
388 chat_template: Optional[str],
389 tools: Optional[list[dict[str, Any]]],
390 - given_format: ChatTemplateContentFormatOption,
390 tokenizer: AnyTokenizer,
391 *,
392 model_config: ModelConfig,
@@ -408,7 +407,7 @@ def _resolve_chat_template_content_format(
407 detected_format = ("string" if jinja_text is None else
408 _detect_content_format(jinja_text, default="string"))
409
411 - return detected_format if given_format == "auto" else given_format
410 + return detected_format
411
412
413 @lru_cache
@@ -451,7 +450,6 @@ def resolve_chat_template_content_format(
450 detected_format = _resolve_chat_template_content_format(
451 chat_template,
452 tools,
454 - given_format,
453 tokenizer,
454 model_config=model_config,
455 )
@@ -462,7 +460,8 @@ def resolve_chat_template_content_format(
460 detected_format=detected_format,
461 )
462
465 - return detected_format
463 + return detected_format if given_format == "auto" else given_format
464 +
465
466
467 ModalityStr = Literal["image", "audio", "video", "image_embeds"]