forked from npuichigo/openai_trtllm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And use it in Triton chat completions and legacy completions. For Mistral-7B-Instruct-v0.2, here is an example template for chat completions. Put it in /etc/ai-router/templates/chat/mistral.j2: ``` {%- set bos_token = '<s>' -%} {% set eos_token = '</s>' -%} {{ bos_token -}} {%- for message in messages -%} {% if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%} {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} {% endif -%} {% if message['role'] == 'user' -%} {{ '[INST] ' + message['content'] + ' [/INST]' -}} {% elif message ['role'] == 'assistant' -%} {{ ' ' + message['content'] + eos_token -}} {% else -%} {{ raise_exception('Only user and assistant roles are supported!') }} {% endif -%} {% endfor %} ``` And configure the prompt_format in /etc/ai-router.toml: ``` [models.chat_completions."Mistral-7B-Instruct-v0.2"] ... prompt_format = "mistral" ``` For legacy completions, a different template is needed, in /etc/ai-router/templates/completions/mistral.j2: ``` [INST] {% for message in messages -%} {{ message -}} {% endfor %} [/INST] ``` Closes: #4
- Loading branch information
Showing
13 changed files
with
163 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ pub mod routes; | |
pub mod startup; | ||
mod state; | ||
pub mod telemetry; | ||
mod templater; | ||
mod tokenizers; | ||
mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.