From 97fb860eba42e1018abc9b603f8e4602e84dd153 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Mon, 29 Apr 2024 23:34:55 -0400 Subject: [PATCH] feat: Update llama.cpp --- llama_cpp/llama_cpp.py | 21 +++++++++++++++++++++ tests/test_llama.py | 2 +- vendor/llama.cpp | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index d00dfcb..9c8f778 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -284,6 +284,27 @@ LLAMA_VOCAB_TYPE_WPM = 3 """BERT tokenizer based on WordPiece""" +# // pre-tokenization types +# enum llama_vocab_pre_type { +# LLAMA_VOCAB_PRE_TYPE_DEFAULT = 0, +# LLAMA_VOCAB_PRE_TYPE_LLAMA3 = 1, +# LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_LLM = 2, +# LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_CODER = 3, +# LLAMA_VOCAB_PRE_TYPE_FALCON = 4, +# LLAMA_VOCAB_PRE_TYPE_MPT = 5, +# LLAMA_VOCAB_PRE_TYPE_STARCODER = 6, +# LLAMA_VOCAB_PRE_TYPE_GPT2 = 7, +# }; +LLAMA_VOCAB_PRE_TYPE_DEFAULT = 0 +LLAMA_VOCAB_PRE_TYPE_LLAMA3 = 1 +LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_LLM = 2 +LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_CODER = 3 +LLAMA_VOCAB_PRE_TYPE_FALCON = 4 +LLAMA_VOCAB_PRE_TYPE_MPT = 5 +LLAMA_VOCAB_PRE_TYPE_STARCODER = 6 +LLAMA_VOCAB_PRE_TYPE_GPT2 = 7 + + # // note: these values should be synchronized with ggml_rope # // TODO: maybe move this enum to ggml.h (ggml_rope_type) # enum llama_rope_type { diff --git a/tests/test_llama.py b/tests/test_llama.py index fa2f6df..469ef91 100644 --- a/tests/test_llama.py +++ b/tests/test_llama.py @@ -6,7 +6,7 @@ from scipy.special import log_softmax import llama_cpp -MODEL = "./vendor/llama.cpp/models/ggml-vocab-llama.gguf" +MODEL = "./vendor/llama.cpp/models/ggml-vocab-llama-spm.gguf" def test_llama_cpp_tokenization(): diff --git a/vendor/llama.cpp b/vendor/llama.cpp index 4dba7e8..8843a98 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit 4dba7e8114d84241c842b986e008af8b88d1a019 +Subproject commit 8843a98c2ba97a25e93319a104f9ddfaf83ce4c4