Method
add_dry
(
self,
model: LlamaModel,
n_ctx_train: int,
dry_multiplier: float,
dry_base: float,
dry_allowed_length: int,
dry_penalty_last_n: int,
seq_breakers: List[str],
)
Source from the content-addressed store, hash-verified
| 798 | llama_cpp.llama_sampler_chain_add(self.sampler, sampler) |
| 799 | |
| 800 | def add_dry( |
| 801 | self, |
| 802 | model: LlamaModel, |
| 803 | n_ctx_train: int, |
| 804 | dry_multiplier: float, |
| 805 | dry_base: float, |
| 806 | dry_allowed_length: int, |
| 807 | dry_penalty_last_n: int, |
| 808 | seq_breakers: List[str], |
| 809 | ): |
| 810 | # Convert seq_breakers to C array |
| 811 | breaker_ptrs = (ctypes.c_char_p * len(seq_breakers))() |
| 812 | for i, breaker in enumerate(seq_breakers): |
| 813 | breaker_ptrs[i] = breaker.encode("utf-8") |
| 814 | |
| 815 | sampler = llama_cpp.llama_sampler_init_dry( |
| 816 | model.vocab, |
| 817 | n_ctx_train, |
| 818 | dry_multiplier, |
| 819 | dry_base, |
| 820 | dry_allowed_length, |
| 821 | dry_penalty_last_n, |
| 822 | breaker_ptrs, |
| 823 | len(seq_breakers), |
| 824 | ) |
| 825 | llama_cpp.llama_sampler_chain_add(self.sampler, sampler) |
| 826 | |
| 827 | def add_logit_bias(self, n_vocab: int, logit_bias: Dict[int, float]): |
| 828 | # Convert logit_bias dict to C array |
Callers
nothing calls this directly
Tested by
no test coverage detected