fix: ignore add_special_tokens and use test mode for generation for mistral tokenizer (#3396) [skip ci]
* fix: ignore add_special_tokens and use test mode for generation * fix: incorrectly setting kwarg
This commit is contained in:
@@ -86,15 +86,15 @@ class HFMistralTokenizer(MistralCommonBackend):
|
|||||||
add_generation_prompt: bool = False,
|
add_generation_prompt: bool = False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> str | list[int]:
|
) -> str | list[int]:
|
||||||
"""Patched fn to handle setting serving mode, continue_final_message, remove chat_template and add_generation_prompt kwarg"""
|
"""Patched fn to handle setting test mode, remove chat_template and add_generation_prompt kwarg"""
|
||||||
|
|
||||||
# pop unnecessary kwarg for mistral
|
# pop unnecessary kwarg for mistral
|
||||||
kwargs.pop("real_last_index", None)
|
kwargs.pop("real_last_index", None)
|
||||||
|
kwargs.pop("add_special_tokens", None)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if add_generation_prompt:
|
if add_generation_prompt:
|
||||||
self._set_mode(ValidationMode.serving)
|
self._set_mode(ValidationMode.test)
|
||||||
kwargs["continue_final_message"] = True
|
|
||||||
|
|
||||||
out = super().apply_chat_template(conversation, **kwargs)
|
out = super().apply_chat_template(conversation, **kwargs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user