Skip to content
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

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

DIYer22
Copy link
Contributor

@DIYer22 DIYer22 commented Nov 6, 2024

Fix #10075 like:

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}
         }'

Internal Server Error%  

Error message on server

TypeError: vllm.entrypoints.chat_utils.apply_hf_chat_template() got multiple values for keyword argument 'continue_final_message'

Copy link

github-actions bot commented Nov 6, 2024

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added the frontend label Nov 6, 2024
@DIYer22
Copy link
Contributor Author

DIYer22 commented Nov 6, 2024

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? 😢

Copy link
Member

@DarkLight1337 DarkLight1337 left a 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.

Comment on lines 447 to 452
_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,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_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,
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this suggestion work?

Copy link
Contributor Author

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,
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

@DarkLight1337 DarkLight1337 left a 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?

@DIYer22
Copy link
Contributor Author

DIYer22 commented Nov 7, 2024

@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.

@DIYer22
Copy link
Contributor Author

DIYer22 commented Nov 7, 2024

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}
         }'

Copy link
Member

@DarkLight1337 DarkLight1337 left a 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.

@DarkLight1337
Copy link
Member

Waiting for CI to be fixed internally before starting the merge process.

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) November 7, 2024 06:32
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 7, 2024
@DarkLight1337 DarkLight1337 merged commit 0dfba97 into vllm-project:main Nov 7, 2024
49 of 51 checks passed
Isotr0py pushed a commit to Isotr0py/vllm that referenced this pull request Nov 8, 2024
…ct#10075) (vllm-project#10076)

Signed-off-by: Lei <ylxx@live.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
JC1DA pushed a commit to JC1DA/vllm that referenced this pull request Nov 11, 2024
…ct#10075) (vllm-project#10076)

Signed-off-by: Lei <ylxx@live.com>
Signed-off-by: Loc Huynh <jc1da.3011@gmail.com>
sumitd2 pushed a commit to sumitd2/vllm that referenced this pull request Nov 14, 2024
…ct#10075) (vllm-project#10076)

Signed-off-by: Lei <ylxx@live.com>
Signed-off-by: Sumit Dubey <sumit.dubey2@ibm.com>
KuntaiDu pushed a commit to KuntaiDu/vllm that referenced this pull request Nov 20, 2024
mfournioux pushed a commit to mfournioux/vllm that referenced this pull request Nov 20, 2024
…ct#10075) (vllm-project#10076)

Signed-off-by: Lei <ylxx@live.com>
Signed-off-by: Maxime Fournioux <55544262+mfournioux@users.noreply.github.com>
tlrmchlsmth pushed a commit to neuralmagic/vllm that referenced this pull request Nov 23, 2024
…ct#10075) (vllm-project#10076)

Signed-off-by: Lei <ylxx@live.com>
Signed-off-by: Tyler Michael Smith <tyler@neuralmagic.com>
sleepwalker2017 pushed a commit to sleepwalker2017/vllm that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: When apply continue_final_message, encounter: got multiple values for keyword argument
2 participants