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

LLama3ChatSession example fails to work with LLama 2 model #937

Open
asmirnov82 opened this issue Oct 2, 2024 · 0 comments · May be fixed by #938
Open

LLama3ChatSession example fails to work with LLama 2 model #937

asmirnov82 opened this issue Oct 2, 2024 · 0 comments · May be fixed by #938

Comments

@asmirnov82
Copy link
Contributor

asmirnov82 commented Oct 2, 2024

Description

LLama3ChatSession example is said to "supports models such as llama3, llama2, phi3, qwen1.5, etc".
However it fails due to several reasons:

  1. Null reference exception (as in ;lama2 model.Tokens.EndOfTurnToken is not defined in metadata and that's why is null)
  2. PromtTemplateTransformer doesn't work correctly with llama2. According to https://www.llama.com/docs/model-cards-and-prompt-formats/meta-llama-2 and https://huggingface.co/blog/llama2#how-to-prompt-llama-2, llama2 should be prompted using this template:
<s>[INST]
{{ system_prompt }}
<</SYS>>

{{ user_message_1 }} [/INST] {{ model_answer_1 }} </s>
<s>[INST] {{ user_message_2 }} [/INST]

Llama2 doesn't provide chat template in metadata, so by default different template is used by llama.cpp:

<|im_start|>user
hello<|im_end|>
<|im_start|>assistant
response<|im_end|>
<|im_start|>user
again<|im_end|>
<|im_start|>assistant
response<|im_end|>

As a result, conversation using LLama3 example after fixing NullRefence exception looks like this:
image

It would be nice to have an example that uses custom HistoryTransform for llama2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant