Skip to content

Commit 6dffee0

Browse files
authored
fix handling chat templates in uft-8 encoding (#3563)
1 parent cfa983e commit 6dffee0

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

docs/deploying_server_baremetal.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ Run `setupvars` script to set required environment variables.
127127

128128
> **Note**: If package contains Python, running this script changes Python settings for the shell that runs it. Environment variables are set only for the current shell so make sure you rerun the script before using model server in a new shell.
129129
130-
> **Note**: If package contains Python, OVMS uses Python's Jinja package to apply chat template when serving LLMs. In such case, please ensure you have Windows "Beta Unicode UTF-8 for worldwide language support" enabled. [Instruction](llm_utf8_troubleshoot.png)
131-
132130
You can also build model server from source by following the [developer guide](windows_developer_guide.md).
133131

134132
:::

docs/llm_utf8_troubleshoot.png

-88.3 KB
Binary file not shown.

src/llm/servable_initializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void GenAiServableInitializer::loadPyTemplateProcessor(std::shared_ptr<GenAiServ
9292
# Try to read data from tokenizer_config.json
9393
tokenizer_config_file = Path(templates_directory + "/tokenizer_config.json")
9494
if tokenizer_config_file.is_file():
95-
f = open(templates_directory + "/tokenizer_config.json")
95+
f = open(templates_directory + "/tokenizer_config.json", "r", encoding="utf-8")
9696
data = json.load(f)
9797
bos_token = data.get("bos_token", "")
9898
bos_token = "" if bos_token is None else bos_token # Null token conversion to empty string.

0 commit comments

Comments
 (0)