Merge branch 'abetlen:main' into th-neu-dockerfile-slim
This commit is contained in:
commit
5672ed7fea
4 changed files with 6 additions and 6 deletions
|
@ -639,7 +639,7 @@ class Llama:
|
||||||
self.detokenize([token]).decode("utf-8", errors="ignore")
|
self.detokenize([token]).decode("utf-8", errors="ignore")
|
||||||
for token in all_tokens
|
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(
|
for token, token_str, logprobs_token in zip(
|
||||||
all_tokens, all_token_strs, all_logprobs
|
all_tokens, all_token_strs, all_logprobs
|
||||||
):
|
):
|
||||||
|
@ -985,7 +985,7 @@ class Llama:
|
||||||
return llama_cpp.llama_token_bos()
|
return llama_cpp.llama_token_bos()
|
||||||
|
|
||||||
@staticmethod
|
@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]
|
exps = [math.exp(float(x)) for x in logits]
|
||||||
sum_exps = sum(exps)
|
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]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "llama_cpp_python"
|
name = "llama_cpp_python"
|
||||||
version = "0.1.41"
|
version = "0.1.42"
|
||||||
description = "Python bindings for the llama.cpp library"
|
description = "Python bindings for the llama.cpp library"
|
||||||
authors = ["Andrei Betlen <abetlen@gmail.com>"]
|
authors = ["Andrei Betlen <abetlen@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -10,7 +10,7 @@ setup(
|
||||||
description="A Python wrapper for llama.cpp",
|
description="A Python wrapper for llama.cpp",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
version="0.1.41",
|
version="0.1.42",
|
||||||
author="Andrei Betlen",
|
author="Andrei Betlen",
|
||||||
author_email="abetlen@gmail.com",
|
author_email="abetlen@gmail.com",
|
||||||
license="MIT",
|
license="MIT",
|
||||||
|
|
2
vendor/llama.cpp
vendored
2
vendor/llama.cpp
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit e216aa04633892b972d013719e38b59fd4917341
|
Subproject commit 2edbdb0f99336cb41f0995061c7602ed54beb863
|
Loading…
Add table
Reference in a new issue