-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[BugFix][Frontend] Use LoRA tokenizer in OpenAI APIs #6227
[BugFix][Frontend] Use LoRA tokenizer in OpenAI APIs #6227
Conversation
Currently the LoRA tokenizers aren't used in the OpenAI APIs, meaning the behaviour won't be correct if adapters are used that have custom added tokens. This PR includes changes to address that. It mostly replaces vllm-project#3512. More work is needed to address remaining inconsistencies in tokenization behaviour between the OpenAI front-end and standalone LLMEngine/AsyncLLMEngine use, including: - Standalone cases don't honor truncation and add_special_tokens request parameters - OpenAI API cases don't make use of TokenizerGroups for possible parallelization of tokenization As well as some other inefficiencies. But these are to be addressed in follow-on PRs.
@dtrifiro FYI |
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.
Left some comments!
If possible, try to add a test case to verify whether the OpenAI-compatible server can apply the correct chat template.
Thanks @DarkLight1337, yes test is forthcoming. |
…okenizer-take2 # Conflicts: # vllm/entrypoints/openai/serving_chat.py # vllm/entrypoints/openai/serving_completion.py # vllm/entrypoints/openai/serving_engine.py
We can merge after the test case is added. |
…okenizer-take2 # Conflicts: # tests/async_engine/test_chat_template.py # tests/entrypoints/openai/test_completion.py # vllm/entrypoints/openai/serving_chat.py # vllm/entrypoints/openai/serving_completion.py
…okenizer-take2 # Conflicts: # tests/entrypoints/openai/test_chat.py # tests/entrypoints/openai/test_completion.py # tests/entrypoints/openai/test_tokenization.py
@DarkLight1337 tests now added! and there were a lot of merge conflicts to resolve 😅 |
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.
Just a small question.
The error occurs because the |
Thanks @DarkLight1337! I pushed a fix before I read your comment, hopefully this should be ok too. |
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Signed-off-by: Alvant <alvasian@yandex.ru>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Currently the LoRA tokenizers aren't used in the OpenAI APIs, meaning the behaviour won't be correct if adapters are used that have custom added tokens. This PR includes changes to address that. It mostly replaces #3512.
More work is needed to address remaining inconsistencies in tokenization behaviour between the OpenAI front-end and standalone
LLMEngine
/AsyncLLMEngine
use, including:TokenizerGroup
s for possible parallelization of tokenizationas well as some other inefficiencies.
But these are to be addressed in follow-on PRs.