Skip to content

Support converting models with multiple chat templates#6588

Merged
ggerganov merged 6 commits intoggml-org:masterfrom
CISC:multiple-chat-templates
Apr 18, 2024
Merged

Support converting models with multiple chat templates#6588
ggerganov merged 6 commits intoggml-org:masterfrom
CISC:multiple-chat-templates

Conversation

@CISC
Copy link
Copy Markdown
Member

@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

CISC added 6 commits April 10, 2024 15:31
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 ggml-org:master Apr 18, 2024
@CISC CISC deleted the multiple-chat-templates branch April 20, 2024 06:10
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* Support converting models with multiple chat templates

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`.

* replace filtered characters with underscore

* New script to add/modify/remove metadata

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 files via upload

add new script to project/readme

* flake--
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* Support converting models with multiple chat templates

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`.

* replace filtered characters with underscore

* New script to add/modify/remove metadata

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 files via upload

add new script to project/readme

* flake--
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