-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[Bugfix] Fix chat template loading #15143
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] Fix chat template loading #15143
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run 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 either: Add 🚀 |
Signed-off-by: DarkLight1337 <[email protected]>
892ad54 to
94f5a99
Compare
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Co-authored-by: chaunceyjiang <[email protected]> Signed-off-by: DarkLight1337 <[email protected]>
Co-authored-by: chaunceyjiang <[email protected]> Signed-off-by: DarkLight1337 <[email protected]>
Isotr0py
left a comment
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.
LGTM!
ywang96
left a comment
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 confirm this PR fixes chat template for a few models I tried, but it looks like the CI is still not passing..
|
Yeah I will check that out today or tomorrow. |
Signed-off-by: DarkLight1337 <[email protected]>
|
Should be fixed now |
Signed-off-by: DarkLight1337 <[email protected]>
|
I think there are some differences between the chat template in the model repo versus the chat template of the tokenizer of |
|
Hmm - it seems that the new chat template is skipping the system prompt loading. Main: This branch: Now checking the default behavior of huggingface import requests
from PIL import Image
import torch
from transformers import AutoProcessor, LlavaOnevisionForConditionalGeneration, AutoTokenizer
model_id = "llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
model = LlavaOnevisionForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
).to(0)
processor = AutoProcessor.from_pretrained(model_id)
messages = [
{
"role": "user",
"content": [
{"type": "video", "url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"},
{"type": "text", "text": "What's in this video?"},
],
},
]
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
print(repr(prompt))Output: Given this branch is more aligned with the default behavior of huggingface, I will update the test accordingly. |
Signed-off-by: Roger Wang <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: Roger Wang <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Roger Wang <[email protected]> Co-authored-by: chaunceyjiang <[email protected]> Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Roger Wang <[email protected]> Co-authored-by: chaunceyjiang <[email protected]> Co-authored-by: Roger Wang <[email protected]> Signed-off-by: Wes Medford <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Roger Wang <[email protected]> Co-authored-by: chaunceyjiang <[email protected]> Co-authored-by: Roger Wang <[email protected]> Signed-off-by: Louis Ulmer <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Roger Wang <[email protected]> Co-authored-by: chaunceyjiang <[email protected]> Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Roger Wang <[email protected]> Co-authored-by: chaunceyjiang <[email protected]> Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Roger Wang <[email protected]> Co-authored-by: chaunceyjiang <[email protected]> Co-authored-by: Roger Wang <[email protected]> Signed-off-by: Mu Huai <[email protected]>
AutoProcessor's chat template take precedence overAutoTokenizerFIX #14884
FIX #15095
FIX #15125
Thanks @chaunceyjiang who helped with fixing #15095!