Skip to content

Add Command R chat template#6650

Merged
ngxson merged 4 commits intoggml-org:masterfrom
jc19chaoj:command-r-chat-template
Apr 14, 2024
Merged

Add Command R chat template#6650
ngxson merged 4 commits intoggml-org:masterfrom
jc19chaoj:command-r-chat-template

Conversation

@jc19chaoj
Copy link
Copy Markdown
Contributor

Added the chat template for c4ai-command-r-v01 and c4ai-command-r-plus in llama_chat_apply_template_internal so that we can use --chat-template command-r option when running command-r models using llama.cpp's openai api server.

The command-r chat template follows this format: <BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{system}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>{prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>{response}

@ngxson
Copy link
Copy Markdown
Contributor

ngxson commented Apr 13, 2024

We're missing test case for this template. Please follow the full procedure from this article to add a new template.

@satyaloka93
Copy link
Copy Markdown

Thanks for submitting this, eagerly awaiting it's approval!!

@jc19chaoj
Copy link
Copy Markdown
Contributor Author

We're missing test case for this template. Please follow the full procedure from this article to add a new template.

Chat template test for command-R is now added.

@satyaloka93
Copy link
Copy Markdown

Works for me! Had to drop my context to 2k on my RTX 4090 to get it working in IQ_4_XS quant.

Copy link
Copy Markdown
Contributor

@ngxson ngxson left a comment

Choose a reason for hiding this comment

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

@ngxson ngxson merged commit 04fbc5f into ggml-org:master Apr 14, 2024
@jc19chaoj jc19chaoj deleted the command-r-chat-template branch April 15, 2024 01:37
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* Add chat template for command-r model series

* Fix indentation

* Add chat template test for command-r models and update the implementation to trim whitespaces

* Remove debug print
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* Add chat template for command-r model series

* Fix indentation

* Add chat template test for command-r models and update the implementation to trim whitespaces

* Remove debug print
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.

3 participants