Skip to content

< Back


ISamplingPipeline

Namespace: LLama.Sampling

Convert a span of logits into a single sampled token. This interface can be implemented to completely customise the sampling process.

1
public interface ISamplingPipeline : System.IDisposable

Implements IDisposable
Attributes NullableContextAttribute

Methods

Sample(SafeLLamaContextHandle, Int32)

Sample a single token from the given context at the given position

1
LLamaToken Sample(SafeLLamaContextHandle ctx, int index)

Parameters

ctx SafeLLamaContextHandle
The context being sampled from

index Int32
Position to sample logits from

Returns

LLamaToken

Apply(SafeLLamaContextHandle, LLamaTokenDataArray)

Apply this pipeline to a set of token data

1
void Apply(SafeLLamaContextHandle ctx, LLamaTokenDataArray data)

Parameters

ctx SafeLLamaContextHandle

data LLamaTokenDataArray

Reset()

Reset all internal state of the sampling pipeline

1
void Reset()

Accept(LLamaToken)

Update the pipeline, with knowledge that a particular token was just accepted

1
void Accept(LLamaToken token)

Parameters

token LLamaToken


< Back