Skip to content

Commit 9fc8254

Browse files
committed
fix the custom samplers ArgumentError
1 parent c7a1e13 commit 9fc8254

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llama_cpp/_internals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ def free_wrapper(sampler: llama_cpp.llama_sampler_p):
791791
self.sampler = llama_cpp.llama_sampler_init(ctypes.pointer(sampler_i), None)
792792

793793
def get_sampler(self) -> llama_cpp.llama_sampler_p:
794-
return ctypes.pointer(self.sampler)
794+
return self.sampler
795795

796796

797797
class LlamaSampler:
@@ -998,7 +998,7 @@ def add_custom(
998998
self._add_sampler(sampler)
999999
# NOTE: Must remove custom samplers before free or llama.cpp will try to free them
10001000
self.custom_samplers.append(
1001-
(llama_cpp.llama_sampler_chain_n(self.sampler) - 1, custom_sampler)
1001+
[llama_cpp.llama_sampler_chain_n(self.sampler) - 1, custom_sampler]
10021002
)
10031003

10041004
def _add_sampler(self, sampler: llama_cpp.llama_sampler_p):

0 commit comments

Comments
 (0)