-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: "--tokenizer-mode", "mistral"
not compatible with openai API tool use tests
#9059
Comments
Hey @sydnash, Did you try to use --tokenizer_format mistral for tool use as shown here: https://github.com/vllm-project/vllm/blob/main/examples/offline_chat_with_tools.py Mistral's tokenizer cannot work with: "--tool-call-parser", "mistral", "--chat-template",
str(VLLM_PATH / "examples/tool_chat_template_mistral.jinja"), and that's expected actually |
I modified it like this, but the problem still remains the same.
In the example here |
yes that's required when using mistral_common
As said above mistral_common doesn't work with chat templates nor a tool call parser => can you just do: "arguments": [
"--ignore-patterns=\"consolidated.safetensors\"",
"--tokenizer-mode", "mistral", "--load-format", "mistral", "--config-format", "mistral"
], jinja templates are not used in mistral_common |
Yes I know this. The Mistral model's tool call of OpenAI API currently works without requiring the
However, using |
Can you give me a command that shows what doesn't work? |
How to reproduce this bug:
tests/tool_use/conftest.py:
tests/tool_use/utils.py:
run the tests in the tests directory:
The tests will fail. I do not know dose these message enough. If you do not want the tool parser and template, you can remove it from the step two. |
The problem seems to actually originates from a current bug in the Pydantic library where attributes declared as iterables are replaced in the instances by pydantic-core When the
The
The bug is not seen when chat templates are used, since the The bug is known on Pydantic side, and this indeed particularly affects the I have opened #9951 to fix this part |
@patrickvonplaten regarding the compatibility of the Not filtering the tool_call special token when tokens are filtered to be converted makes the mistral tool call parser correctly pick up the tool_calls output by the model since the mistral tool parser checks for the presence of this token to decide if tool calls are present and need to be parsed.
Would this be an acceptable change to do ? The implication in the What do you think ? |
@sydnash with the following changes:
the tests are passing:
|
Your current environment
The output of `python collect_env.py`
Model Input Dumps
No response
🐛 Describe the bug
The tests in
tests/tool_use
for mistral FAILED while add"--tokenizer-mode", "mistral"
at the start ofvllm serve
.How to reproduce this bug:
tests/tool_use/utils.py
.tests/tool_use/conftest.py
to only test the mistral model.tests/tool_use/conftest.py:
tests/tool_use/utils.py:
run the tests in the tests directory:
The tests will fail.
@patrickvonplaten
I believe this is not just a bug in MistralTokenizer, but rather an incompatibility between the OpenAI API implementation and MistralTokenizer's implementation.
Based on my current testing, there are the following four issues:
self.model_tokenizer.tokenizer.
to overwriteself.model_tokenizer
.apply_mistral_chat_template
need to change fromrequest.messages
toconversation
due to this error:^[a-zA-Z0-9]{9}$
regex or modify the tool call id's verify due to this error:MistralTokenizer
.The output message has no
[TOOL_CALLS]
, which is used to identify it as a tool call message.Before submitting a new issue...
The text was updated successfully, but these errors were encountered: