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

Chat streaming is not working with Phi 2 #617

Closed
rupeshs opened this issue Jul 12, 2024 · 5 comments · Fixed by #697
Closed

Chat streaming is not working with Phi 2 #617

rupeshs opened this issue Jul 12, 2024 · 5 comments · Fixed by #697
Assignees
Labels
bug Something isn't working PSE

Comments

@rupeshs
Copy link

rupeshs commented Jul 12, 2024

Used sample code: https://github.com/openvinotoolkit/openvino.genai/blob/master/samples/python/chat_sample/chat_sample.py

ov_streaming_issue.mp4
@rupeshs rupeshs changed the title Chat streaming not working with Phi 2 Chat streaming is not working with Phi 2 Jul 12, 2024
@avitial avitial added the support_request Support team label Jul 21, 2024
@YuChern-Intel YuChern-Intel self-assigned this Jul 21, 2024
@YuChern-Intel
Copy link

To use Phi-2 model, run with beam_search_causal_lm, greedy_causal_lm or multinomial_causal_lm.

@rupeshs
Copy link
Author

rupeshs commented Jul 22, 2024

@YuChern-Intel
Copy link

YuChern-Intel commented Jul 22, 2024

I had validated in running the microsoft/phi-2 model with these demos.

@olpipi
Copy link
Collaborator

olpipi commented Jul 26, 2024

Hi @rupeshs
The root cause is phi-2 model doesn't have chat template. Probably it is not tuned as chat. That's why it doesn't have template.
Genai pipeline crashes when you start chat scenario without chat template. I will fix it to return correct error.

If you want to run chat with phi-2 model, you should add chat_template field into tokenizer_config.json. See phi-3 for example.
I tried this template:
"chat_template": "{% for message in messages %}{% if (message['role'] == 'user') %}{{'Instruct: ' + message['content'] + '\nOutput:'}}{% elif (message['role'] == 'assistant') %}{{message['content'] + '\n'}}{% endif %}{% endfor %}"
It is not official, so I cannot guarantee it will work properly

@olpipi
Copy link
Collaborator

olpipi commented Jul 29, 2024

#697 - fix segfault

@avitial avitial added bug Something isn't working and removed support_request Support team labels Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PSE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants