@@ -93,9 +93,7 @@ def _load_shared_library(lib_base_name: str):
9393
9494# from ggml-backend.h
9595# typedef bool (*ggml_backend_sched_eval_callback)(struct ggml_tensor * t, bool ask, void * user_data);
96- ggml_backend_sched_eval_callback = ctypes .CFUNCTYPE (
97- c_bool , c_void_p , c_bool , c_void_p
98- )
96+ ggml_backend_sched_eval_callback = ctypes .CFUNCTYPE (c_bool , c_void_p , c_bool , c_void_p )
9997
10098# llama.h bindings
10199
@@ -2174,6 +2172,34 @@ def llama_sample_typical(
21742172_lib .llama_sample_typical .restype = None
21752173
21762174
2175+ # /// @details Dynamic temperature implementation described in the paper https://arxiv.org/abs/2309.02772.
2176+ # LLAMA_API void llama_sample_entropy(
2177+ # struct llama_context * ctx,
2178+ # llama_token_data_array * candidates_p,
2179+ # float min_temp,
2180+ # float max_temp,
2181+ # float exponent_val);
2182+ def llama_sample_entropy (
2183+ ctx : llama_context_p ,
2184+ candidates , # type: _Pointer[llama_token_data_array]
2185+ min_temp : Union [c_float , float ],
2186+ max_temp : Union [c_float , float ],
2187+ exponent_val : Union [c_float , float ],
2188+ ):
2189+ """Dynamic temperature implementation described in the paper https://arxiv.org/abs/2309.02772."""
2190+ return _lib .llama_sample_entropy (ctx , candidates , min_temp , max_temp , exponent_val )
2191+
2192+
2193+ _lib .llama_sample_entropy .argtypes = [
2194+ llama_context_p ,
2195+ llama_token_data_array_p ,
2196+ c_float ,
2197+ c_float ,
2198+ c_float ,
2199+ ]
2200+ _lib .llama_sample_entropy .restype = None
2201+
2202+
21772203# LLAMA_API void llama_sample_temp(
21782204# struct llama_context * ctx,
21792205# llama_token_data_array * candidates,
0 commit comments