From e937066420b79a757bf80e9836eb12b88420a218 Mon Sep 17 00:00:00 2001 From: slaren Date: Sun, 19 Nov 2023 11:10:52 +0100 Subject: gguf-py : export chat templates (#4125) * gguf-py : export chat templates * llama.cpp : escape new lines in gguf kv info prints * gguf-py : bump version * gguf-py : check chat_template type * gguf-py : initialize chat_template --- gguf-py/gguf/gguf_writer.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gguf-py/gguf/gguf_writer.py') diff --git a/gguf-py/gguf/gguf_writer.py b/gguf-py/gguf/gguf_writer.py index c3b8c588..ab7382c4 100644 --- a/gguf-py/gguf/gguf_writer.py +++ b/gguf-py/gguf/gguf_writer.py @@ -399,6 +399,9 @@ class GGUFWriter: def add_add_eos_token(self, value: bool) -> None: self.add_bool(Keys.Tokenizer.ADD_EOS, value) + def add_chat_template(self, value: str) -> None: + self.add_string(Keys.Tokenizer.CHAT_TEMPLATE, value) + def _pack(self, fmt: str, value: Any, skip_pack_prefix: bool = False) -> bytes: pack_prefix = '' if not skip_pack_prefix: -- cgit v1.2.3