Skip to content

Commit 7e66ee2

Browse files
mofosynetybalex
authored andcommitted
gguf.py : add licence and version to gguf writer (ggml-org#6504)
1 parent 3994c11 commit 7e66ee2

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

gguf-py/gguf/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class General:
2424
ALIGNMENT = "general.alignment"
2525
NAME = "general.name"
2626
AUTHOR = "general.author"
27+
VERSION = "general.version"
2728
URL = "general.url"
2829
DESCRIPTION = "general.description"
2930
LICENSE = "general.license"

gguf-py/gguf/gguf_writer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ def add_architecture(self) -> None:
296296
def add_author(self, author: str) -> None:
297297
self.add_string(Keys.General.AUTHOR, author)
298298

299+
def add_version(self, version: str) -> None:
300+
self.add_string(Keys.General.VERSION, version)
301+
299302
def add_tensor_data_layout(self, layout: str) -> None:
300303
self.add_string(Keys.LLM.TENSOR_DATA_LAYOUT.format(arch=self.arch), layout)
301304

@@ -305,6 +308,9 @@ def add_url(self, url: str) -> None:
305308
def add_description(self, description: str) -> None:
306309
self.add_string(Keys.General.DESCRIPTION, description)
307310

311+
def add_licence(self, licence: str) -> None:
312+
self.add_string(Keys.General.LICENSE, licence)
313+
308314
def add_source_url(self, url: str) -> None:
309315
self.add_string(Keys.General.SOURCE_URL, url)
310316

llama.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ enum llm_kv {
261261
LLM_KV_GENERAL_ALIGNMENT,
262262
LLM_KV_GENERAL_NAME,
263263
LLM_KV_GENERAL_AUTHOR,
264+
LLM_KV_GENERAL_VERSION,
264265
LLM_KV_GENERAL_URL,
265266
LLM_KV_GENERAL_DESCRIPTION,
266267
LLM_KV_GENERAL_LICENSE,
@@ -330,6 +331,7 @@ static const std::map<llm_kv, const char *> LLM_KV_NAMES = {
330331
{ LLM_KV_GENERAL_ALIGNMENT, "general.alignment" },
331332
{ LLM_KV_GENERAL_NAME, "general.name" },
332333
{ LLM_KV_GENERAL_AUTHOR, "general.author" },
334+
{ LLM_KV_GENERAL_VERSION, "general.version" },
333335
{ LLM_KV_GENERAL_URL, "general.url" },
334336
{ LLM_KV_GENERAL_DESCRIPTION, "general.description" },
335337
{ LLM_KV_GENERAL_LICENSE, "general.license" },

0 commit comments

Comments
 (0)