]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
gguf.py : add licence and version to gguf writer (#6504)
authorBrian <redacted>
Fri, 5 Apr 2024 18:41:38 +0000 (05:41 +1100)
committerGitHub <redacted>
Fri, 5 Apr 2024 18:41:38 +0000 (21:41 +0300)
gguf-py/gguf/constants.py
gguf-py/gguf/gguf_writer.py
llama.cpp

index 5214764a9ea98e5895f92fe0cac5a8e9229101bb..c44d8abeb857fef03e5209a7dafc24f29b0dc88a 100644 (file)
@@ -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"
index 2ae6c814b52de155a3ac222fce9b2ff1e9263b08..f4c4407667bda04cace93408f19e017fe0ef28da 100644 (file)
@@ -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)
 
index 9a1c11043b94ad6a6c2364b568a5da894d0f4c5e..217726184879f1a5ed6ef6e794c18530decc8160 100644 (file)
--- a/llama.cpp
+++ b/llama.cpp
@@ -261,6 +261,7 @@ enum llm_kv {
     LLM_KV_GENERAL_ALIGNMENT,
     LLM_KV_GENERAL_NAME,
     LLM_KV_GENERAL_AUTHOR,
+    LLM_KV_GENERAL_VERSION,
     LLM_KV_GENERAL_URL,
     LLM_KV_GENERAL_DESCRIPTION,
     LLM_KV_GENERAL_LICENSE,
@@ -330,6 +331,7 @@ static const std::map<llm_kv, const char *> LLM_KV_NAMES = {
     { LLM_KV_GENERAL_ALIGNMENT,             "general.alignment"                     },
     { LLM_KV_GENERAL_NAME,                  "general.name"                          },
     { LLM_KV_GENERAL_AUTHOR,                "general.author"                        },
+    { LLM_KV_GENERAL_VERSION,               "general.version"                       },
     { LLM_KV_GENERAL_URL,                   "general.url"                           },
     { LLM_KV_GENERAL_DESCRIPTION,           "general.description"                   },
     { LLM_KV_GENERAL_LICENSE,               "general.license"                       },