-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Frontend] Fix multiple values for keyword argument error (#10075) #10076
Conversation
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can do one of these:
🚀 |
I've tried many times and still don't know how to write the code to pass the mypy type check, can anyone help me? 😢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing, please resolve the type errors.
_chat_template_kwargs = dict( | ||
chat_template=chat_template, | ||
add_generation_prompt=add_generation_prompt, | ||
continue_final_message=continue_final_message, | ||
tools=tool_dicts, | ||
documents=documents, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_chat_template_kwargs = dict( | |
chat_template=chat_template, | |
add_generation_prompt=add_generation_prompt, | |
continue_final_message=continue_final_message, | |
tools=tool_dicts, | |
documents=documents, | |
) | |
_chat_template_kwargs = ChatTemplateKwargs( | |
chat_template=chat_template, | |
add_generation_prompt=add_generation_prompt, | |
continue_final_message=continue_final_message, | |
tools=tool_dicts, | |
documents=documents, | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this suggestion work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not work, still can't pass the type check of mypy.
tools=tool_dicts, | ||
documents=documents, | ||
**(chat_template_kwargs or {}), | ||
tokenize=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended? This argument wasn't there before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for pass mypy type checking. When using **dict
in function, you need to explicitly call all the typed parameters defined by the function, otherwise it will not pass the mypy type check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note here to indicate this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good; can you add a test to verify this behavior?
…ct#10075) Signed-off-by: Lei <ylxx@live.com>
@DarkLight1337 I finally found a simple, scientific way to pass mypy type check, please review it. This change is too simple, and there was no test code for this before, so I don't think it's necessary to add new testcase. |
I have deployed this fixed version of the branch on my public server. You can test it directly like this curl -X POST "http://39.105.21.95:12481/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Meta-Llama-3-8B-Instruct",
"messages": [
{
"role": "user",
"content": "tell me a common saying"
},
{
"role": "assistant",
"content": "Here is a common saying about apple. An apple a day, keeps"
}
],
"add_generation_prompt": false, "chat_template_kwargs":{"continue_final_message": true}
}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, as long as the code works for you.
Waiting for CI to be fixed internally before starting the merge process. |
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com> Signed-off-by: Isotr0py <2037008807@qq.com>
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com> Signed-off-by: Loc Huynh <jc1da.3011@gmail.com>
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com> Signed-off-by: Sumit Dubey <sumit.dubey2@ibm.com>
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com>
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com> Signed-off-by: Maxime Fournioux <55544262+mfournioux@users.noreply.github.com>
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com> Signed-off-by: Tyler Michael Smith <tyler@neuralmagic.com>
…ct#10075) (vllm-project#10076) Signed-off-by: Lei <ylxx@live.com>
Fix #10075 like:
Error message on server