mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-07-10 05:17:09 +08:00
[Frontend] Fix chat template content format detection (#18190)
Signed-off-by: Sebastian Schönnenbeck <sebastian.schoennenbeck@comma-soft.com>
This commit is contained in:
parent
51ff154639
commit
2aa5470ac5
@ -387,7 +387,6 @@ def resolve_hf_chat_template(
|
|||||||
def _resolve_chat_template_content_format(
|
def _resolve_chat_template_content_format(
|
||||||
chat_template: Optional[str],
|
chat_template: Optional[str],
|
||||||
tools: Optional[list[dict[str, Any]]],
|
tools: Optional[list[dict[str, Any]]],
|
||||||
given_format: ChatTemplateContentFormatOption,
|
|
||||||
tokenizer: AnyTokenizer,
|
tokenizer: AnyTokenizer,
|
||||||
*,
|
*,
|
||||||
model_config: ModelConfig,
|
model_config: ModelConfig,
|
||||||
@ -408,7 +407,7 @@ def _resolve_chat_template_content_format(
|
|||||||
detected_format = ("string" if jinja_text is None else
|
detected_format = ("string" if jinja_text is None else
|
||||||
_detect_content_format(jinja_text, default="string"))
|
_detect_content_format(jinja_text, default="string"))
|
||||||
|
|
||||||
return detected_format if given_format == "auto" else given_format
|
return detected_format
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
@lru_cache
|
||||||
@ -451,7 +450,6 @@ def resolve_chat_template_content_format(
|
|||||||
detected_format = _resolve_chat_template_content_format(
|
detected_format = _resolve_chat_template_content_format(
|
||||||
chat_template,
|
chat_template,
|
||||||
tools,
|
tools,
|
||||||
given_format,
|
|
||||||
tokenizer,
|
tokenizer,
|
||||||
model_config=model_config,
|
model_config=model_config,
|
||||||
)
|
)
|
||||||
@ -462,7 +460,8 @@ def resolve_chat_template_content_format(
|
|||||||
detected_format=detected_format,
|
detected_format=detected_format,
|
||||||
)
|
)
|
||||||
|
|
||||||
return detected_format
|
return detected_format if given_format == "auto" else given_format
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ModalityStr = Literal["image", "audio", "video", "image_embeds"]
|
ModalityStr = Literal["image", "audio", "video", "image_embeds"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user