Skip to content

Commit

Permalink
Removed tail free sampling, deprecated upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
martindevans committed Oct 31, 2024
1 parent 29390d3 commit 652c1e1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
11 changes: 0 additions & 11 deletions LLama/Native/NativeApi.Sampling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);


/// <summary>
/// Tail Free Sampling described in https://www.trentonbricken.com/Tail-Free-Sampling/.
/// </summary>
/// <param name="ctx"></param>
/// <param name="candidates">Pointer to LLamaTokenDataArray</param>
/// <param name="z"></param>
/// <param name="min_keep"></param>
[DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void llama_sample_tail_free(SafeLLamaContextHandle ctx, ref LLamaTokenDataArrayNative candidates, float z, ulong min_keep);

/// <summary>
/// Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666.
/// </summary>
Expand Down
13 changes: 0 additions & 13 deletions LLama/Native/SafeLLamaSamplerHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,6 @@ public void AddMinP(float p, nint minKeep)
// ReSharper restore InconsistentNaming
}

/// <summary>
/// Minimum P sampling as described in https://github.com/ggerganov/llama.cpp/pull/3841
/// </summary>
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
}

/// <summary>
/// Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions LLama/Sampling/DefaultSamplingPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ public float AlphaPresence
/// </summary>
public int TopK { get; init; } = 40;

/// <summary>
/// Z value for tail free sampling
/// </summary>
public float TailFreeZ { get; init; } = 1;

/// <summary>
/// P value for locally typical sampling
/// </summary>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 652c1e1

Please sign in to comment.