From c67cbcb0f5581005799d3d82ba0f506494776212 Mon Sep 17 00:00:00 2001 From: NanoCode012 Date: Tue, 10 Feb 2026 18:03:26 +0700 Subject: [PATCH] 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 --- src/axolotl/utils/mistral/mistral_tokenizer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axolotl/utils/mistral/mistral_tokenizer.py b/src/axolotl/utils/mistral/mistral_tokenizer.py index a5ffe9a28..45a0308f9 100644 --- a/src/axolotl/utils/mistral/mistral_tokenizer.py +++ b/src/axolotl/utils/mistral/mistral_tokenizer.py @@ -86,15 +86,15 @@ class HFMistralTokenizer(MistralCommonBackend): add_generation_prompt: bool = False, **kwargs, ) -> 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 kwargs.pop("real_last_index", None) + kwargs.pop("add_special_tokens", None) try: if add_generation_prompt: - self._set_mode(ValidationMode.serving) - kwargs["continue_final_message"] = True + self._set_mode(ValidationMode.test) out = super().apply_chat_template(conversation, **kwargs)