Unverified Commit 8c87a9ad authored by Chauncey's avatar Chauncey Committed by GitHub
Browse files

[Bugfix] Fix AssertionError: skip_special_tokens=False is not supported for...


[Bugfix] Fix AssertionError: skip_special_tokens=False is not supported for Mistral tokenizers (#16964)
Signed-off-by: default avatarchaunceyjiang <chaunceyjiang@gmail.com>
parent ec69124e
...@@ -72,10 +72,14 @@ class MistralToolParser(ToolParser): ...@@ -72,10 +72,14 @@ class MistralToolParser(ToolParser):
def adjust_request( def adjust_request(
self, request: ChatCompletionRequest) -> ChatCompletionRequest: self, request: ChatCompletionRequest) -> ChatCompletionRequest:
if request.tools and request.tool_choice != 'none': if not isinstance(
# do not skip special tokens because mistral uses the special self.model_tokenizer, MistralTokenizer
# tokens to indicate the start and end of the tool calls ) and request.tools and request.tool_choice != 'none':
# information. # Do not skip special tokens when using chat template
# with Mistral parser as TOOL_CALL token is needed
# for tool detection.
# Note: we don't want skip_special_tokens=False
# with MistralTokenizer as it is incompatible
request.skip_special_tokens = False request.skip_special_tokens = False
return request return request
......
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