]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : add Minerva 7B model support (#10673)
authorRiccardo Orlando <redacted>
Thu, 5 Dec 2024 18:30:59 +0000 (19:30 +0100)
committerGitHub <redacted>
Thu, 5 Dec 2024 18:30:59 +0000 (20:30 +0200)
* Support for Minerva 7B

* Update convert_hf_to_gguf_update.py

convert_hf_to_gguf.py
convert_hf_to_gguf_update.py
include/llama.h
src/llama-vocab.cpp
src/llama.cpp

index d8df5cc00195174001e14db6eea53d0375688b8c..9f1419e29eb4eb8bf9849454f8ce39d7be13c10b 100755 (executable)
@@ -658,6 +658,9 @@ class Model:
         if chkhsh == "60824e3c0d9401f89943cbb2fff727f0e2d4c545ba4df2d6e4f09a6db0f5b450":
             # ref: https://huggingface.co/facebook/chameleon-7b
             res = "chameleon"
+        if chkhsh == "1431a23e583c97432bc230bff598d103ddb5a1f89960c8f1d1051aaa944d0b35":
+            # ref: https://huggingface.co/sapienzanlp/Minerva-7B-base-v1.0
+            res = "minerva-7b"
 
         if res is None:
             logger.warning("\n")
index 2a51fce2d8db005d1ed2cf049da4a2395f0d4b42..ce3c571df34537fc04d2fc269629dacb8f36082a 100755 (executable)
@@ -102,6 +102,7 @@ models = [
     {"name": "exaone",         "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct", },
     {"name": "phi-2",          "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/microsoft/phi-2", },
     {"name": "chameleon",      "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/facebook/chameleon-7b", },
+    {"name": "minerva-7b",     "tokt": TOKENIZER_TYPE.BPE, "repo": "https://huggingface.co/sapienzanlp/Minerva-7B-base-v1.0", },
 ]
 
 
index 168c3fa1f6e3b46bec5085737382fc3eb211aabc..d121354c19d56966fb6be93404b7ff0aac5220a6 100644 (file)
@@ -104,6 +104,7 @@ extern "C" {
         LLAMA_VOCAB_PRE_TYPE_GPT3_FINNISH   = 24,
         LLAMA_VOCAB_PRE_TYPE_EXAONE         = 25,
         LLAMA_VOCAB_PRE_TYPE_CHAMELEON      = 26,
+        LLAMA_VOCAB_PRE_TYPE_MINERVA        = 27,
     };
 
     enum llama_rope_type {
index d1dc96276c2a27e74bbc6cd27182e54e54f88b16..8c9aaf5a0c85d1ea17fa63ec92376818c886308c 100644 (file)
@@ -418,6 +418,7 @@ struct llm_tokenizer_bpe : llm_tokenizer {
             case LLAMA_VOCAB_PRE_TYPE_SMOLLM:
             case LLAMA_VOCAB_PRE_TYPE_CODESHELL:
             case LLAMA_VOCAB_PRE_TYPE_EXAONE:
+            case LLAMA_VOCAB_PRE_TYPE_MINERVA:
                 regex_exprs = {
                     "\\p{N}",
                     "'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
index 00f78639e6c9296364d6d2fd6eb3530d943e0941..ba4a9dfcf9ffaae77663ed3d7ec215c1fddd4dd5 100644 (file)
@@ -6479,6 +6479,9 @@ static void llm_load_vocab(
                 vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_CHAMELEON;
                 vocab.tokenizer_add_bos = true;
                 vocab.tokenizer_clean_spaces = false;
+            } else if (
+                tokenizer_pre == "minerva-7b") {
+                vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_MINERVA;
             } else {
                 throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
             }