From 329297fafb4916951cf1c3146505a9501e986d95 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Thu, 4 May 2023 12:18:40 -0400 Subject: [PATCH 1/3] Bugfix: Missing logits_to_logprobs --- llama_cpp/llama.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index fef7b3e..8cd77ee 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -639,7 +639,7 @@ class Llama: self.detokenize([token]).decode("utf-8", errors="ignore") for token in all_tokens ] - all_logprobs = [Llama._logits_to_logprobs(row) for row in self.eval_logits] + all_logprobs = [Llama.logits_to_logprobs(list(map(float, row))) for row in self.eval_logits] for token, token_str, logprobs_token in zip( all_tokens, all_token_strs, all_logprobs ): @@ -985,7 +985,7 @@ class Llama: return llama_cpp.llama_token_bos() @staticmethod - def logits_to_logprobs(logits: List[llama_cpp.c_float]) -> List[llama_cpp.c_float]: + def logits_to_logprobs(logits: List[float]) -> List[float]: exps = [math.exp(float(x)) for x in logits] sum_exps = sum(exps) - return [llama_cpp.c_float(math.log(x / sum_exps)) for x in exps] + return [math.log(x / sum_exps) for x in exps] From d78cec67df876221471782e7e1fbe62abf48ee25 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Thu, 4 May 2023 12:20:25 -0400 Subject: [PATCH 2/3] Update llama.cpp --- vendor/llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/llama.cpp b/vendor/llama.cpp index e216aa0..2edbdb0 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit e216aa04633892b972d013719e38b59fd4917341 +Subproject commit 2edbdb0f99336cb41f0995061c7602ed54beb863 From cabd8b8ed1ee45a19baa9436668898bbe9471492 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Thu, 4 May 2023 12:21:20 -0400 Subject: [PATCH 3/3] Bump version --- pyproject.toml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 64f7a0d..2dab374 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "llama_cpp_python" -version = "0.1.41" +version = "0.1.42" description = "Python bindings for the llama.cpp library" authors = ["Andrei Betlen "] license = "MIT" diff --git a/setup.py b/setup.py index f7f0fa4..0a52826 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( description="A Python wrapper for llama.cpp", long_description=long_description, long_description_content_type="text/markdown", - version="0.1.41", + version="0.1.42", author="Andrei Betlen", author_email="abetlen@gmail.com", license="MIT",