Unverified Commit 2aa5470a authored by Sebastian Schoennenbeck's avatar Sebastian Schoennenbeck Committed by GitHub
Browse files

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


Signed-off-by: default avatarSebastian Schönnenbeck <sebastian.schoennenbeck@comma-soft.com>
parent 51ff1546
......@@ -387,7 +387,6 @@ def resolve_hf_chat_template(
def _resolve_chat_template_content_format(
chat_template: Optional[str],
tools: Optional[list[dict[str, Any]]],
given_format: ChatTemplateContentFormatOption,
tokenizer: AnyTokenizer,
*,
model_config: ModelConfig,
......@@ -408,7 +407,7 @@ def _resolve_chat_template_content_format(
detected_format = ("string" if jinja_text is None else
_detect_content_format(jinja_text, default="string"))
return detected_format if given_format == "auto" else given_format
return detected_format
@lru_cache
......@@ -451,7 +450,6 @@ def resolve_chat_template_content_format(
detected_format = _resolve_chat_template_content_format(
chat_template,
tools,
given_format,
tokenizer,
model_config=model_config,
)
......@@ -462,7 +460,8 @@ def resolve_chat_template_content_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"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment