Unverified Commit d4bce297 authored by Lifu Huang's avatar Lifu Huang Committed by GitHub
Browse files

Fix incorrect logic in chat template handling. (#9336)


Signed-off-by: default avatarXinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: default avatarXinyuan Tong <xinyuantong.cs@gmail.com>
parent b0980af8
......@@ -89,6 +89,7 @@ class TemplateManager:
if template is None:
return False
# TODO: remove this hard code the reasoning pattern
force_reasoning_pattern = r"<\|im_start\|>assistant\\n<think>\\n"
has_reasoning = re.search(force_reasoning_pattern, template) is not None
......@@ -128,11 +129,12 @@ class TemplateManager:
logger.info(
f"Using default HuggingFace chat template with detected content format: {self._jinja_template_content_format}"
)
return
# Default to string content format if no template was found
self._jinja_template_content_format = "string"
logger.info("No chat template found, defaulting to 'string' content format")
else:
# Default to string content format if no template was found
self._jinja_template_content_format = "string"
logger.info(
"No chat template found, defaulting to 'string' content format"
)
# Detect reasoning pattern from chat template
if tokenizer_manager.tokenizer:
......
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