From 652c1e1d179d629294cb7d21a26e8ef2b682eaed Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Thu, 31 Oct 2024 16:21:57 +0000 Subject: [PATCH] Removed tail free sampling, deprecated upstream --- LLama/Native/NativeApi.Sampling.cs | 11 ----------- LLama/Native/SafeLLamaSamplerHandle.cs | 13 ------------- LLama/Sampling/DefaultSamplingPipeline.cs | 6 ------ 3 files changed, 30 deletions(-) diff --git a/LLama/Native/NativeApi.Sampling.cs b/LLama/Native/NativeApi.Sampling.cs index 4b73d2e0b..6012823d8 100644 --- a/LLama/Native/NativeApi.Sampling.cs +++ b/LLama/Native/NativeApi.Sampling.cs @@ -99,17 +99,6 @@ public static void llama_sample_apply_guidance(SafeLLamaContextHandle ctx, Span< [DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)] public static extern void llama_sample_min_p(SafeLLamaContextHandle ctx, ref LLamaTokenDataArrayNative candidates, float p, ulong min_keep); - - /// - /// Tail Free Sampling described in https://www.trentonbricken.com/Tail-Free-Sampling/. - /// - /// - /// Pointer to LLamaTokenDataArray - /// - /// - [DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)] - public static extern void llama_sample_tail_free(SafeLLamaContextHandle ctx, ref LLamaTokenDataArrayNative candidates, float z, ulong min_keep); - /// /// Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666. /// diff --git a/LLama/Native/SafeLLamaSamplerHandle.cs b/LLama/Native/SafeLLamaSamplerHandle.cs index 69abf51dc..ef6a7ae30 100644 --- a/LLama/Native/SafeLLamaSamplerHandle.cs +++ b/LLama/Native/SafeLLamaSamplerHandle.cs @@ -306,19 +306,6 @@ public void AddMinP(float p, nint minKeep) // ReSharper restore InconsistentNaming } - /// - /// Minimum P sampling as described in https://github.com/ggerganov/llama.cpp/pull/3841 - /// - public void AddTailFree(float z, nint minKeep) - { - llama_sampler_chain_add(this, llama_sampler_init_tail_free(z, minKeep)); - - // ReSharper disable InconsistentNaming - [DllImport(NativeApi.libraryName, CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr llama_sampler_init_tail_free(float p, nint min_keep); - // ReSharper restore InconsistentNaming - } - /// /// Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666. /// diff --git a/LLama/Sampling/DefaultSamplingPipeline.cs b/LLama/Sampling/DefaultSamplingPipeline.cs index 0cb1bdbab..ee339be1f 100644 --- a/LLama/Sampling/DefaultSamplingPipeline.cs +++ b/LLama/Sampling/DefaultSamplingPipeline.cs @@ -83,11 +83,6 @@ public float AlphaPresence /// public int TopK { get; init; } = 40; - /// - /// Z value for tail free sampling - /// - public float TailFreeZ { get; init; } = 1; - /// /// P value for locally typical sampling /// @@ -135,7 +130,6 @@ protected override SafeLLamaSamplerChainHandle CreateChain(SafeLLamaContextHandl ); chain.AddTopK(TopK); - chain.AddTailFree(TailFreeZ, MinKeep); chain.AddTypical(TypicalP, MinKeep); chain.AddTopP(TopP, MinKeep); chain.AddMinP(MinP, MinKeep);