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

Support converting models with multiple chat templates #6588

Merged
merged 6 commits into from
Apr 18, 2024

Conversation

CISC
Copy link
Contributor

@CISC CISC commented Apr 10, 2024

Adds the following metadata:

  • tokenizer.chat_templates
  • tokenizer.chat_template.<name1>
  • tokenizer.chat_template.<name2>
  • tokenizer.chat_template.<...>

Where tokenizer.chat_templates is an array of the template names (except default), default is added to the regular tokenizer.chat_template. The templates can then easily be discovered and retrieved by name.

Fixes #6484

The new gguf-new-metadata.py script is a somewhat cleaner and more advanced alternative to an earlier proposal:
Fixes #5897
Closes #6156

Adds the following metadata:
* tokenizer.chat_templates
* tokenizer.chat_template.<name1>
* tokenizer.chat_template.<name2>
* tokenizer.chat_template.<...>

Where `tokenizer.chat_templates` is an array of the template names (except `default`), `default` is added to the regular `tokenizer.chat_template`.
This scripts creates a copy of a GGUF file and allows you to add/modify/remove metadata in the process.

Most importantly this allows you to update chat templates, either as a string or directly from an updated tokenizer_config.json file.
add new script to project/readme
@ggerganov ggerganov merged commit 03c0946 into ggerganov:master Apr 18, 2024
21 checks passed
@CISC CISC deleted the multiple-chat-templates branch April 20, 2024 06:10
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.

Models with multiple chat templates Add chat_template to exist gguf file
2 participants