Skip to content

Commit aa3c003

Browse files
committed
Clean up binding compatibility shims
1 parent 58c9f11 commit aa3c003

4 files changed

Lines changed: 26 additions & 420 deletions

File tree

llama_cpp/_internals.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import ctypes
5+
import warnings
56

67
from typing import (
78
Dict,
@@ -699,8 +700,11 @@ def add_dist(self, seed: int):
699700
llama_cpp.llama_sampler_chain_add(self.sampler, sampler)
700701

701702
def add_softmax(self):
702-
sampler = llama_cpp.llama_sampler_init_softmax()
703-
llama_cpp.llama_sampler_chain_add(self.sampler, sampler)
703+
warnings.warn(
704+
"add_softmax is deprecated; llama_sampler_init_dist now samples directly from logits",
705+
DeprecationWarning,
706+
stacklevel=2,
707+
)
704708

705709
def add_top_k(self, k: int):
706710
sampler = llama_cpp.llama_sampler_init_top_k(k)

llama_cpp/llama.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ def apply_func(token_data_array: llama_cpp.llama_token_data_array_p):
730730
sampler.add_grammar(self._model, grammar)
731731

732732
if temp < 0.0:
733-
sampler.add_softmax()
734733
sampler.add_dist(self._seed)
735734
elif temp == 0.0:
736735
sampler.add_greedy()

0 commit comments

Comments
 (0)