[Bugfix] Add missing attributes in mistral tokenizer (#8364)

This commit is contained in:
Cyrus Leung
2024-09-12 02:36:54 +08:00
committed by GitHub
parent aea02f30de
commit 7015417fd4
2 changed files with 62 additions and 31 deletions

View File

@@ -519,11 +519,14 @@ def apply_hf_chat_template(
def apply_mistral_chat_template(
tokenizer: MistralTokenizer,
messages: List[ChatCompletionMessageParam],
chat_template: Optional[str],
chat_template: Optional[str] = None,
**kwargs: Any,
) -> List[int]:
if chat_template is not None:
logger.warning(
"'chat_template' cannot be overridden for mistral tokenizer.")
return tokenizer.apply_chat_template(
messages=messages,
chat_template=chat_template,
**kwargs,
)