From 0537a3f6b289c380fa4ba9e8cf29b94896f2ea69 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 01:43:39 -0700 Subject: [PATCH 1/8] merged https://github.com/zpin/llama-cpp-python/tree/xtc_dry with latest changes --- llama_cpp/_internals.py | 22 +++++++++++++++++++++ llama_cpp/llama.py | 44 +++++++++++++++++++++++++++++++++++++++++ llama_cpp/llama_cpp.py | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index b5175a7f2..52a8adba3 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -703,6 +703,28 @@ def add_temp_ext(self, t: float, delta: float, exponent: float): def add_xtc(self, p: float, t: float, min_keep: int, seed: int): sampler = llama_cpp.llama_sampler_init_xtc(p, t, min_keep, seed) llama_cpp.llama_sampler_chain_add(self.sampler, sampler) + + # def add_dry(self, model: LlamaModel, ctx: LlamaContext, multiplier: float, base: float, + # allowed_length: int, penalty_last_n: int, seq_breakers: list[str] = []): + + # # Convert Python strings to bytes + # seq_breakers_bytes = [s.encode('utf-8') for s in seq_breakers] + # # Create array of char* + # arr = (ctypes.c_char_p * len(seq_breakers_bytes))(*seq_breakers_bytes) + # sampler = llama_cpp.llama_sampler_init_dry(model.vocab, ctx.n_ctx(), multiplier, base, + # allowed_length, penalty_last_n, + # arr, len(seq_breakers)) + # self._add_sampler(sampler) + def add_dry(self, m: float, b: float, l: int, n: int, breakers: List[str]): + # Convert breakers to C array + seq_breakers_bytes = [s.encode('utf-8') for s in breakers] + arr = (ctypes.c_char_p * len(seq_breakers_bytes))(*seq_breakers_bytes) + sampler = llama_cpp.llama_sampler_init_dry( + None, 0, m, b, l, n, + arr, + len(breakers) + ) + llama_cpp.llama_sampler_chain_add(self.sampler, sampler) def add_top_n_sigma(self, n: float): sampler = llama_cpp.llama_sampler_init_top_n_sigma(n) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 71d94ebd8..00eeb8e41 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -682,6 +682,13 @@ def _init_sampler( mirostat_mode: int = 0, mirostat_eta: float = 0.1, mirostat_tau: float = 5.0, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], penalize_nl: bool = True, logits_processor: Optional[LogitsProcessorList] = None, grammar: Optional[LlamaGrammar] = None, @@ -749,11 +756,13 @@ def apply_func(token_data_array: llama_cpp.llama_token_data_array_p): else: n_probs = 0 min_keep = max(1, n_probs) + sampler.add_dry(self._model, self._ctx, dry_multiplier, dry_base, dry_allowed_length, dry_penalty_last_n, dry_seq_breakers) sampler.add_top_k(top_k) sampler.add_typical(typical_p, min_keep) sampler.add_top_p(top_p, min_keep) sampler.add_min_p(min_p, min_keep) sampler.add_temp(temp) + sampler.add_xtc(xtc_probability, xtc_threshold, min_keep, self._seed) sampler.add_dist(self._seed) return sampler @@ -771,6 +780,13 @@ def sample( mirostat_mode: int = 0, mirostat_eta: float = 0.1, mirostat_tau: float = 5.0, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], penalize_nl: bool = True, logits_processor: Optional[LogitsProcessorList] = None, grammar: Optional[LlamaGrammar] = None, @@ -806,6 +822,13 @@ def sample( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, penalize_nl=penalize_nl, logits_processor=logits_processor, grammar=grammar, @@ -835,6 +858,13 @@ def generate( mirostat_mode: int = 0, mirostat_tau: float = 5.0, mirostat_eta: float = 0.1, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], penalize_nl: bool = True, logits_processor: Optional[LogitsProcessorList] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, @@ -874,6 +904,13 @@ def generate( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, penalize_nl=penalize_nl, logits_processor=logits_processor, grammar=grammar, @@ -926,6 +963,13 @@ def generate( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, logits_processor=logits_processor, grammar=grammar, penalize_nl=penalize_nl, diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index 711d42a6a..f1e4324b0 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -3884,6 +3884,41 @@ def llama_sampler_init_xtc( ) -> llama_sampler_p: ... +# LLAMA_API struct llama_sampler * llama_sampler_init_dry( +# const struct llama_vocab * vocab, +# int32_t context_size, +# float dry_multiplier, +# float dry_base, +# int32_t dry_allowed_length, +# int32_t dry_penalty_last_n, +# const char ** seq_breakers, +# size_t num_breakers); +@ctypes_function( +"llama_sampler_init_dry", + [ + llama_vocab_p_ctypes, + ctypes.c_int32, + ctypes.c_float, + ctypes.c_float, + ctypes.c_int32, + ctypes.c_int32, + ctypes.POINTER(ctypes.c_char_p), + ctypes.c_size_t + ], + llama_sampler_p_ctypes, +) +def llama_sampler_init_dry( + vocab: llama_vocab_p, + context_size: int, + dry_multiplier: float, + dry_base: float, + dry_allowed_length: int, + dry_penalty_last_n: int, + seq_breakers: list[str], + num_breakers: int, +) -> llama_sampler_p: + ... + # /// @details Top n sigma sampling as described in academic paper "Top-nσ: Not All Logits Are You Need" https://arxiv.org/pdf/2411.07641 # LLAMA_API struct llama_sampler * llama_sampler_init_top_n_sigma(float n); From 6d0370bb402b8206ff5866c6cd49c72ef189add5 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 02:06:42 -0700 Subject: [PATCH 2/8] added high level support --- llama_cpp/llama.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 00eeb8e41..64b5ffb30 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -1186,6 +1186,13 @@ def _create_completion( mirostat_mode: int = 0, mirostat_tau: float = 5.0, mirostat_eta: float = 0.1, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], model: Optional[str] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, logits_processor: Optional[LogitsProcessorList] = None, @@ -1374,6 +1381,13 @@ def logit_bias_processor( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, frequency_penalty=frequency_penalty, presence_penalty=presence_penalty, repeat_penalty=repeat_penalty, @@ -1806,6 +1820,13 @@ def create_completion( mirostat_mode: int = 0, mirostat_tau: float = 5.0, mirostat_eta: float = 0.1, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], model: Optional[str] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, logits_processor: Optional[LogitsProcessorList] = None, @@ -1835,6 +1856,13 @@ def create_completion( mirostat_mode: The mirostat sampling mode. mirostat_tau: The target cross-entropy (or surprise) value you want to achieve for the generated text. A higher value corresponds to more surprising or less predictable text, while a lower value corresponds to less surprising or more predictable text. mirostat_eta: The learning rate used to update `mu` based on the error between the target and observed surprisal of the sampled word. A larger learning rate will cause `mu` to be updated more quickly, while a smaller learning rate will result in slower updates. + xtc_probability: ??? + xtc_threshold: ??? + dry_multiplier: ??? + dry_allowed_length: ??? + dry_base: ??? + dry_penalty_last_n: ??? + dry_seq_breakers: ??? model: The name to use for the model in the completion object. stopping_criteria: A list of stopping criteria to use. logits_processor: A list of logits processors to use. @@ -1869,6 +1897,13 @@ def create_completion( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, model=model, stopping_criteria=stopping_criteria, logits_processor=logits_processor, @@ -1903,6 +1938,13 @@ def __call__( mirostat_mode: int = 0, mirostat_tau: float = 5.0, mirostat_eta: float = 0.1, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], model: Optional[str] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, logits_processor: Optional[LogitsProcessorList] = None, @@ -1966,6 +2008,13 @@ def __call__( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, model=model, stopping_criteria=stopping_criteria, logits_processor=logits_processor, @@ -1997,6 +2046,13 @@ def create_chat_completion( mirostat_mode: int = 0, mirostat_tau: float = 5.0, mirostat_eta: float = 0.1, + xtc_probability: float = 0.0, + xtc_threshold: float = 0.1, + dry_multiplier: float = 0.0, + dry_allowed_length: int = 2, + dry_base: float = 1.75, + dry_penalty_last_n: int = -1, + dry_seq_breakers: list[str] = [], model: Optional[str] = None, logits_processor: Optional[LogitsProcessorList] = None, grammar: Optional[LlamaGrammar] = None, @@ -2070,6 +2126,13 @@ def create_chat_completion( mirostat_mode=mirostat_mode, mirostat_tau=mirostat_tau, mirostat_eta=mirostat_eta, + xtc_probability=xtc_probability, + xtc_threshold=xtc_threshold, + dry_multiplier=dry_multiplier, + dry_allowed_length=dry_allowed_length, + dry_base=dry_base, + dry_penalty_last_n=dry_penalty_last_n, + dry_seq_breakers=dry_seq_breakers, model=model, logits_processor=logits_processor, grammar=grammar, From 06a2cddc2b4ee2a3291411a616a9547dbe7c72ac Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 02:55:54 -0700 Subject: [PATCH 3/8] maybe fixed it? --- llama_cpp/_internals.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index 52a8adba3..0659788fd 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -715,16 +715,16 @@ def add_xtc(self, p: float, t: float, min_keep: int, seed: int): # allowed_length, penalty_last_n, # arr, len(seq_breakers)) # self._add_sampler(sampler) - def add_dry(self, m: float, b: float, l: int, n: int, breakers: List[str]): - # Convert breakers to C array - seq_breakers_bytes = [s.encode('utf-8') for s in breakers] - arr = (ctypes.c_char_p * len(seq_breakers_bytes))(*seq_breakers_bytes) - sampler = llama_cpp.llama_sampler_init_dry( - None, 0, m, b, l, n, - arr, - len(breakers) - ) - llama_cpp.llama_sampler_chain_add(self.sampler, sampler) + # def add_dry(self, m: float, b: float, l: int, n: int, breakers: List[str]): + # # Convert breakers to C array + # seq_breakers_bytes = [s.encode('utf-8') for s in breakers] + # arr = (ctypes.c_char_p * len(seq_breakers_bytes))(*seq_breakers_bytes) + # sampler = llama_cpp.llama_sampler_init_dry( + # None, 0, m, b, l, n, + # arr, + # len(breakers) + # ) + # llama_cpp.llama_sampler_chain_add(self.sampler, sampler) def add_top_n_sigma(self, n: float): sampler = llama_cpp.llama_sampler_init_top_n_sigma(n) @@ -790,8 +790,8 @@ def add_dry( model: LlamaModel, n_ctx_train: int, dry_multiplier: float, - dry_base: float, dry_allowed_length: int, + dry_base: float, dry_penalty_last_n: int, seq_breakers: List[str] ): @@ -804,8 +804,8 @@ def add_dry( model.vocab, n_ctx_train, dry_multiplier, - dry_base, dry_allowed_length, + dry_base, dry_penalty_last_n, breaker_ptrs, len(seq_breakers) From 1b1aa180cac8ce0686e16052ea4e8fdc680dc420 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 03:09:00 -0700 Subject: [PATCH 4/8] ugh --- llama_cpp/_internals.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index 0659788fd..ba26039f9 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -790,8 +790,8 @@ def add_dry( model: LlamaModel, n_ctx_train: int, dry_multiplier: float, - dry_allowed_length: int, dry_base: float, + dry_allowed_length: int, dry_penalty_last_n: int, seq_breakers: List[str] ): @@ -801,14 +801,14 @@ def add_dry( breaker_ptrs[i] = breaker.encode("utf-8") sampler = llama_cpp.llama_sampler_init_dry( - model.vocab, - n_ctx_train, - dry_multiplier, - dry_allowed_length, - dry_base, - dry_penalty_last_n, - breaker_ptrs, - len(seq_breakers) + vocab=model.vocab, + n_ctx_train=n_ctx_train, + dry_multiplier=dry_multiplier, + dry_base=dry_base, + dry_allowed_length=dry_allowed_length, + dry_penalty_last_n=dry_penalty_last_n, + breaker_ptrs=breaker_ptrs, + num_breakers=len(seq_breakers) ) llama_cpp.llama_sampler_chain_add(self.sampler, sampler) From b37e24336475d21fe26a418b74daea31da1e4570 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 03:23:29 -0700 Subject: [PATCH 5/8] I guess it doesn't like kwargs? --- llama_cpp/_internals.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index ba26039f9..aa5f7da1f 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -801,14 +801,22 @@ def add_dry( breaker_ptrs[i] = breaker.encode("utf-8") sampler = llama_cpp.llama_sampler_init_dry( - vocab=model.vocab, - n_ctx_train=n_ctx_train, - dry_multiplier=dry_multiplier, - dry_base=dry_base, - dry_allowed_length=dry_allowed_length, - dry_penalty_last_n=dry_penalty_last_n, - breaker_ptrs=breaker_ptrs, - num_breakers=len(seq_breakers) + # vocab=model.vocab, + # n_ctx_train=n_ctx_train, + # dry_multiplier=dry_multiplier, + # dry_base=dry_base, + # dry_allowed_length=dry_allowed_length, + # dry_penalty_last_n=dry_penalty_last_n, + # breaker_ptrs=breaker_ptrs, + # num_breakers=len(seq_breakers) + model.vocab, + n_ctx_train, + dry_multiplier, + dry_base, + dry_allowed_length, + dry_penalty_last_n, + breaker_ptrs, + len(seq_breakers) ) llama_cpp.llama_sampler_chain_add(self.sampler, sampler) From c29697d74036ca44d527192e60456028db805627 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 03:41:07 -0700 Subject: [PATCH 6/8] I wish I knew C++ --- llama_cpp/_internals.py | 6 +++--- llama_cpp/llama_cpp.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index aa5f7da1f..59e335db2 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -809,14 +809,14 @@ def add_dry( # dry_penalty_last_n=dry_penalty_last_n, # breaker_ptrs=breaker_ptrs, # num_breakers=len(seq_breakers) - model.vocab, + # model.vocab, n_ctx_train, dry_multiplier, dry_base, dry_allowed_length, dry_penalty_last_n, - breaker_ptrs, - len(seq_breakers) + # breaker_ptrs, + # len(seq_breakers) ) llama_cpp.llama_sampler_chain_add(self.sampler, sampler) diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index f1e4324b0..22225012b 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -3908,14 +3908,14 @@ def llama_sampler_init_xtc( llama_sampler_p_ctypes, ) def llama_sampler_init_dry( - vocab: llama_vocab_p, - context_size: int, + # vocab: llama_vocab_p, + # context_size: int, dry_multiplier: float, dry_base: float, dry_allowed_length: int, dry_penalty_last_n: int, - seq_breakers: list[str], - num_breakers: int, + # seq_breakers: list[str], + # num_breakers: int, ) -> llama_sampler_p: ... From d0da4f10db9c187bc19a524d7a20e6dddade7a99 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 03:55:04 -0700 Subject: [PATCH 7/8] I really hate that I don't know C++ --- llama_cpp/llama_cpp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index 22225012b..58f93b06e 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -3896,20 +3896,20 @@ def llama_sampler_init_xtc( @ctypes_function( "llama_sampler_init_dry", [ - llama_vocab_p_ctypes, + # llama_vocab_p_ctypes, ctypes.c_int32, ctypes.c_float, ctypes.c_float, ctypes.c_int32, ctypes.c_int32, - ctypes.POINTER(ctypes.c_char_p), - ctypes.c_size_t + # ctypes.POINTER(ctypes.c_char_p), + # ctypes.c_size_t ], llama_sampler_p_ctypes, ) def llama_sampler_init_dry( # vocab: llama_vocab_p, - # context_size: int, + context_size: int, dry_multiplier: float, dry_base: float, dry_allowed_length: int, From 08b3c9f1967ee3daa55f03cfd81efa5b5f0b77b7 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 8 Oct 2025 06:59:41 -0700 Subject: [PATCH 8/8] I think I might be an idiot... Excuse: I'm tired --- llama_cpp/_internals.py | 10 +++++----- llama_cpp/llama_cpp.py | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index 59e335db2..6f396e49a 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -788,7 +788,7 @@ def add_penalties( def add_dry( self, model: LlamaModel, - n_ctx_train: int, + ctx: LlamaContext, dry_multiplier: float, dry_base: float, dry_allowed_length: int, @@ -809,14 +809,14 @@ def add_dry( # dry_penalty_last_n=dry_penalty_last_n, # breaker_ptrs=breaker_ptrs, # num_breakers=len(seq_breakers) - # model.vocab, - n_ctx_train, + model.vocab, + ctx.n_ctx(), dry_multiplier, dry_base, dry_allowed_length, dry_penalty_last_n, - # breaker_ptrs, - # len(seq_breakers) + breaker_ptrs, + len(seq_breakers) ) llama_cpp.llama_sampler_chain_add(self.sampler, sampler) diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index 58f93b06e..f1e4324b0 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -3896,26 +3896,26 @@ def llama_sampler_init_xtc( @ctypes_function( "llama_sampler_init_dry", [ - # llama_vocab_p_ctypes, + llama_vocab_p_ctypes, ctypes.c_int32, ctypes.c_float, ctypes.c_float, ctypes.c_int32, ctypes.c_int32, - # ctypes.POINTER(ctypes.c_char_p), - # ctypes.c_size_t + ctypes.POINTER(ctypes.c_char_p), + ctypes.c_size_t ], llama_sampler_p_ctypes, ) def llama_sampler_init_dry( - # vocab: llama_vocab_p, + vocab: llama_vocab_p, context_size: int, dry_multiplier: float, dry_base: float, dry_allowed_length: int, dry_penalty_last_n: int, - # seq_breakers: list[str], - # num_breakers: int, + seq_breakers: list[str], + num_breakers: int, ) -> llama_sampler_p: ...