mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-30 08:42:00 +00:00 
			
		
		
		
	convert : Support chat_template.json (#12460)
This commit is contained in:
		| @@ -154,7 +154,12 @@ class SpecialVocab: | |||||||
|             return True |             return True | ||||||
|         with open(tokenizer_config_file, encoding = 'utf-8') as f: |         with open(tokenizer_config_file, encoding = 'utf-8') as f: | ||||||
|             tokenizer_config = json.load(f) |             tokenizer_config = json.load(f) | ||||||
|         chat_template = tokenizer_config.get('chat_template') |         chat_template_alt = None | ||||||
|  |         chat_template_file = path / 'chat_template.json' | ||||||
|  |         if chat_template_file.is_file(): | ||||||
|  |             with open(chat_template_file, encoding = 'utf-8') as f: | ||||||
|  |                 chat_template_alt = json.load(f).get('chat_template') | ||||||
|  |         chat_template = tokenizer_config.get('chat_template', chat_template_alt) | ||||||
|         if chat_template is None or isinstance(chat_template, (str, list)): |         if chat_template is None or isinstance(chat_template, (str, list)): | ||||||
|             self.chat_template = chat_template |             self.chat_template = chat_template | ||||||
|         else: |         else: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sigbjørn Skjæret
					Sigbjørn Skjæret