Merge branch 'main' into add-numpy-support
This commit is contained in:
commit
878c7d363f
3 changed files with 13 additions and 10 deletions
|
@ -368,10 +368,10 @@ n_keep = {self.params.n_keep}
|
||||||
id = llama_cpp.llama_sample_token_mirostat_v2(self.ctx, candidates_p, llama_cpp.c_float(self.params.mirostat_tau), llama_cpp.c_float(self.params.mirostat_eta), llama_cpp.c_float(mirostat_mu))
|
id = llama_cpp.llama_sample_token_mirostat_v2(self.ctx, candidates_p, llama_cpp.c_float(self.params.mirostat_tau), llama_cpp.c_float(self.params.mirostat_eta), llama_cpp.c_float(mirostat_mu))
|
||||||
else:
|
else:
|
||||||
# Temperature sampling
|
# Temperature sampling
|
||||||
llama_cpp.llama_sample_top_k(self.ctx, candidates_p, top_k)
|
llama_cpp.llama_sample_top_k(self.ctx, candidates_p, top_k, min_keep=llama_cpp.c_size_t(1))
|
||||||
llama_cpp.llama_sample_tail_free(self.ctx, candidates_p, llama_cpp.c_float(self.params.tfs_z))
|
llama_cpp.llama_sample_tail_free(self.ctx, candidates_p, llama_cpp.c_float(self.params.tfs_z), min_keep=llama_cpp.c_size_t(1))
|
||||||
llama_cpp.llama_sample_typical(self.ctx, candidates_p, llama_cpp.c_float(self.params.typical_p))
|
llama_cpp.llama_sample_typical(self.ctx, candidates_p, llama_cpp.c_float(self.params.typical_p), min_keep=llama_cpp.c_size_t(1))
|
||||||
llama_cpp.llama_sample_top_p(self.ctx, candidates_p, llama_cpp.c_float(self.params.top_p))
|
llama_cpp.llama_sample_top_p(self.ctx, candidates_p, llama_cpp.c_float(self.params.top_p), min_keep=llama_cpp.c_size_t(1))
|
||||||
llama_cpp.llama_sample_temperature(self.ctx, candidates_p, llama_cpp.c_float(self.params.temp))
|
llama_cpp.llama_sample_temperature(self.ctx, candidates_p, llama_cpp.c_float(self.params.temp))
|
||||||
id = llama_cpp.llama_sample_token(self.ctx, candidates_p)
|
id = llama_cpp.llama_sample_token(self.ctx, candidates_p)
|
||||||
# print("`{}`".format(candidates_p.size))
|
# print("`{}`".format(candidates_p.size))
|
||||||
|
@ -382,12 +382,15 @@ n_keep = {self.params.n_keep}
|
||||||
# replace end of text token with newline token when in interactive mode
|
# replace end of text token with newline token when in interactive mode
|
||||||
if (id == llama_cpp.llama_token_eos() and self.params.interactive and not self.params.instruct):
|
if (id == llama_cpp.llama_token_eos() and self.params.interactive and not self.params.instruct):
|
||||||
id = self.llama_token_newline[0]
|
id = self.llama_token_newline[0]
|
||||||
|
self.embd.append(id)
|
||||||
if (self.use_antiprompt()):
|
if (self.use_antiprompt()):
|
||||||
# tokenize and inject first reverse prompt
|
# tokenize and inject first reverse prompt
|
||||||
self.embd_inp += self.first_antiprompt[0]
|
self.embd_inp += self.first_antiprompt[0]
|
||||||
|
for id in self.first_antiprompt[0]:
|
||||||
# add it to the context
|
self.embd.append(id)
|
||||||
self.embd.append(id)
|
else:
|
||||||
|
# add it to the context
|
||||||
|
self.embd.append(id)
|
||||||
|
|
||||||
# echo this to console
|
# echo this to console
|
||||||
self.output_echo = True
|
self.output_echo = True
|
||||||
|
@ -493,7 +496,7 @@ n_keep = {self.params.n_keep}
|
||||||
# Contains multi-byte UTF8
|
# Contains multi-byte UTF8
|
||||||
for num, pattern in [(2, 192), (3, 224), (4, 240)]:
|
for num, pattern in [(2, 192), (3, 224), (4, 240)]:
|
||||||
# Bitwise AND check
|
# Bitwise AND check
|
||||||
if pattern & int.from_bytes(cur_char) == pattern:
|
if pattern & int.from_bytes(cur_char, 'little') == pattern:
|
||||||
self.multibyte_fix = [cur_char] + ([None] * (num-1))
|
self.multibyte_fix = [cur_char] + ([None] * (num-1))
|
||||||
|
|
||||||
# Stop incomplete bytes from passing
|
# Stop incomplete bytes from passing
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "llama_cpp_python"
|
name = "llama_cpp_python"
|
||||||
version = "0.1.54"
|
version = "0.1.55"
|
||||||
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.54",
|
version="0.1.55",
|
||||||
author="Andrei Betlen",
|
author="Andrei Betlen",
|
||||||
author_email="abetlen@gmail.com",
|
author_email="abetlen@gmail.com",
|
||||||
license="MIT",
|
license="MIT",
|
||||||
|
|
Loading…
Reference in a new issue