summaryrefslogtreecommitdiff
path: root/gguf-py
diff options
context:
space:
mode:
authorBrian <mofosyne@gmail.com>2024-04-06 05:41:38 +1100
committerGitHub <noreply@github.com>2024-04-05 21:41:38 +0300
commita8bd14d55717754a1f48313a846a2b16fa998ad2 (patch)
treeb858dcf1ae50af25dc3c8b185595319354866415 /gguf-py
parentd0f5deebf898f8186a10148a03a56909ba05fc0b (diff)
gguf.py : add licence and version to gguf writer (#6504)
Diffstat (limited to 'gguf-py')
-rw-r--r--gguf-py/gguf/constants.py1
-rw-r--r--gguf-py/gguf/gguf_writer.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py
index 5214764a..c44d8abe 100644
--- a/gguf-py/gguf/constants.py
+++ b/gguf-py/gguf/constants.py
@@ -24,6 +24,7 @@ class Keys:
ALIGNMENT = "general.alignment"
NAME = "general.name"
AUTHOR = "general.author"
+ VERSION = "general.version"
URL = "general.url"
DESCRIPTION = "general.description"
LICENSE = "general.license"
diff --git a/gguf-py/gguf/gguf_writer.py b/gguf-py/gguf/gguf_writer.py
index 2ae6c814..f4c44076 100644
--- a/gguf-py/gguf/gguf_writer.py
+++ b/gguf-py/gguf/gguf_writer.py
@@ -296,6 +296,9 @@ class GGUFWriter:
def add_author(self, author: str) -> None:
self.add_string(Keys.General.AUTHOR, author)
+ def add_version(self, version: str) -> None:
+ self.add_string(Keys.General.VERSION, version)
+
def add_tensor_data_layout(self, layout: str) -> None:
self.add_string(Keys.LLM.TENSOR_DATA_LAYOUT.format(arch=self.arch), layout)
@@ -305,6 +308,9 @@ class GGUFWriter:
def add_description(self, description: str) -> None:
self.add_string(Keys.General.DESCRIPTION, description)
+ def add_licence(self, licence: str) -> None:
+ self.add_string(Keys.General.LICENSE, licence)
+
def add_source_url(self, url: str) -> None:
self.add_string(Keys.General.SOURCE_URL, url)