Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a686171

Browse filesBrowse files
authored
convert : Support chat_template.json (ggml-org#12460)
1 parent c446b2e commit a686171
Copy full SHA for a686171

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎gguf-py/gguf/vocab.py

Copy file name to clipboardExpand all lines: gguf-py/gguf/vocab.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ def _try_load_from_tokenizer_json(self, path: Path) -> bool:
154154
return True
155155
with open(tokenizer_config_file, encoding = 'utf-8') as f:
156156
tokenizer_config = json.load(f)
157-
chat_template = tokenizer_config.get('chat_template')
157+
chat_template_alt = None
158+
chat_template_file = path / 'chat_template.json'
159+
if chat_template_file.is_file():
160+
with open(chat_template_file, encoding = 'utf-8') as f:
161+
chat_template_alt = json.load(f).get('chat_template')
162+
chat_template = tokenizer_config.get('chat_template', chat_template_alt)
158163
if chat_template is None or isinstance(chat_template, (str, list)):
159164
self.chat_template = chat_template
160165
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.