summaryrefslogtreecommitdiff
path: root/gguf-py/gguf/gguf_writer.py
diff options
context:
space:
mode:
authorslaren <slarengh@gmail.com>2023-11-19 11:10:52 +0100
committerGitHub <noreply@github.com>2023-11-19 11:10:52 +0100
commite937066420b79a757bf80e9836eb12b88420a218 (patch)
tree93a3c3a9889c4367e6e6310674d0661cbf0f5d5f /gguf-py/gguf/gguf_writer.py
parent28a2e6e7d476717881be6eb9e2d3331342cec57b (diff)
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
Diffstat (limited to 'gguf-py/gguf/gguf_writer.py')
-rw-r--r--gguf-py/gguf/gguf_writer.py3
1 files changed, 3 insertions, 0 deletions
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: