Skip to content

Commit 5bcd8a6

Browse files
authored
enable chat_template.jinja to fix transformers upgrade (#3583)
1 parent 0adec4a commit 5bcd8a6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

demos/common/export_models/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
--extra-index-url "https://storage.openvinotoolkit.org/simple/wheels/nightly"
33
--extra-index-url "https://storage.openvinotoolkit.org/simple/wheels/pre-release"
44
--pre
5-
optimum-intel
5+
optimum-intel@git+https://github.com/huggingface/optimum-intel.git
66
openvino-tokenizers<=2025.3.0.0.dev20250812
77
openvino<=2025.3.0.dev20250814
88
nncf>=2.11.0
99
sentence_transformers
1010
sentencepiece==0.2.0
1111
openai
12-
transformers<4.53
12+
transformers<4.54
1313
einops
1414
torchvision
1515
timm==1.0.15

src/llm/servable_initializer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,16 @@ void GenAiServableInitializer::loadPyTemplateProcessor(std::shared_ptr<GenAiServ
137137
tool_template = None
138138
139139
# Try to read template from template.jinja file
140-
jinja_file = Path(templates_directory + "/template.jinja")
140+
jinja_file = Path(templates_directory + "/chat_template.jinja")
141+
jinja_file_legacy = Path(templates_directory + "/template.jinja")
141142
template_loader = jinja2.FileSystemLoader(searchpath=templates_directory)
142143
jinja_env = ImmutableSandboxedEnvironment(trim_blocks=True, lstrip_blocks=True, extensions=[AssistantTracker, jinja2.ext.loopcontrols], loader=template_loader)
143144
jinja_env.policies["json.dumps_kwargs"]["ensure_ascii"] = False
144145
jinja_env.globals["raise_exception"] = raise_exception
145146
jinja_env.globals["strftime_now"] = strftime_now
146147
if jinja_file.is_file():
148+
template = jinja_env.get_template("chat_template.jinja")
149+
elif jinja_file_legacy.is_file():
147150
template = jinja_env.get_template("template.jinja")
148151
149152
# Try to read data from tokenizer_config.json

src/test/llm/llmtemplate_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ class LLMChatTemplateHttpTest : public TestWithTempDir {
725725
ON_CALL(*writer, PartialReplyBegin(::testing::_)).WillByDefault(testing::Invoke([](std::function<void()> fn) { fn(); }));
726726
TestWithTempDir::SetUp();
727727
tokenizerConfigFilePath = directoryPath + "/tokenizer_config.json";
728-
jinjaConfigFilePath = directoryPath + "/template.jinja";
728+
jinjaConfigFilePath = directoryPath + "/chat_template.jinja";
729729
ovmsConfigFilePath = directoryPath + "/ovms_config.json";
730730
graphConfigFilePath = directoryPath + "/graph_config.pbtxt";
731731

0 commit comments

Comments
 (0)