We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d84635b commit d1e1ec5Copy full SHA for d1e1ec5
gguf-py/gguf/vocab.py
@@ -154,7 +154,12 @@ def _try_load_from_tokenizer_json(self, path: Path) -> bool:
154
return True
155
with open(tokenizer_config_file, encoding = 'utf-8') as f:
156
tokenizer_config = json.load(f)
157
- chat_template = tokenizer_config.get('chat_template')
+ 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)
163
if chat_template is None or isinstance(chat_template, (str, list)):
164
self.chat_template = chat_template
165
else:
0 commit comments