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

Use chat template #135

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Conversation

DePasqualeOrg
Copy link
Contributor

@DePasqualeOrg DePasqualeOrg commented Sep 29, 2024

Since huggingface/swift-transformers#104, it's now possible to use the chat template from tokenizer_config.json. I've updated LLMEval to use the chat template, but I noticed that the output from the Mistral models ends with <|im_end|>, even when this string is included in extraEOSTokens. Perhaps @pcuenca has an idea why this might be happening?

@DePasqualeOrg DePasqualeOrg marked this pull request as draft September 30, 2024 11:55
@DePasqualeOrg
Copy link
Contributor Author

DePasqualeOrg commented Sep 30, 2024

Using the chat templates with Llama 3.2 will result in an error until none and tojson are is implemented in the Jinja package: johnmai-dev/Jinja#4

@davidkoski
Copy link
Collaborator

Using the chat templates with Llama 3.2 will result in an error until none and tojson are implemented in the Jinja package: maiqingqiang/Jinja#4

OK, should we hold off on taking this until that is merged (and we can pick it up here)?

@DePasqualeOrg
Copy link
Contributor Author

OK, should we hold off on taking this until that is merged (and we can pick it up here)?

Yes, since LLMEval includes model configs for Llama 3.2. In the meantime, this branch can be used to test Llama 3.2 with the work in progress on Jinja.

@DePasqualeOrg
Copy link
Contributor Author

DePasqualeOrg commented Sep 30, 2024

We had a similar issue with an EOS token at the end of the output of Gemma 2: #89

This shouldn't be appearing in the output if it's included in extraEOSTokens. It could be an issue with the tokenizer, because I can see when it's generating in my app that <|im_end|> is being produced as multiple tokens, and it sometimes even continues generating beyond this string.

@DePasqualeOrg
Copy link
Contributor Author

The problem with Mistral 7B is resolved here: huggingface/swift-transformers#134

@DePasqualeOrg DePasqualeOrg marked this pull request as ready for review October 5, 2024 11:20
@DePasqualeOrg
Copy link
Contributor Author

Llama 3.2 1B and 3B and Mistral 7B now work with chat templates, thanks to the changes in swift-transformers and Jinja.

@davidkoski davidkoski mentioned this pull request Oct 22, 2024
Copy link
Collaborator

@davidkoski davidkoski left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@davidkoski davidkoski merged commit 5a7a1a4 into ml-explore:main Oct 22, 2024
3 checks passed
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 this pull request may close these issues.

2 participants