Skip to content

Commit 0874bac

Browse files
committed
class LlamaSampler: append add_xtc() and add_top_n_sigma()
1 parent c392ec2 commit 0874bac

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llama_cpp/_internals.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ def add_typical(self, p: float, min_keep: int):
791791
sampler = llama_cpp.llama_sampler_init_typical(p, min_keep)
792792
self._add_sampler(sampler)
793793

794+
def add_xtc(self, p: float, t: float, min_keep: int, seed: int):
795+
sampler = llama_cpp.llama_sampler_init_xtc(p, t, min_keep, seed)
796+
self._add_sampler(sampler)
797+
794798
def add_temp(self, temp: float):
795799
sampler = llama_cpp.llama_sampler_init_temp(temp)
796800
self._add_sampler(sampler)
@@ -799,6 +803,10 @@ def add_temp_ext(self, t: float, delta: float, exponent: float):
799803
sampler = llama_cpp.llama_sampler_init_temp_ext(t, delta, exponent)
800804
self._add_sampler(sampler)
801805

806+
def add_top_n_sigma(self, n: float):
807+
sampler = llama_cpp.llama_sampler_init_top_n_sigma(n)
808+
self._add_sampler(sampler)
809+
802810
def add_mirostat(self, n_vocab: int, seed: int, tau: float, eta: float, m: int):
803811
sampler = llama_cpp.llama_sampler_init_mirostat(n_vocab, seed, tau, eta, m)
804812
self._add_sampler(sampler)

0 commit comments

Comments
 (0)