Skip to content

< Back


ICustomSampler

Namespace: LLama.Native

A custom sampler stage for modifying logits or selecting a token

1
public interface ICustomSampler : System.IDisposable

Implements IDisposable
Attributes NullableContextAttribute

Properties

Name

The human readable name of this stage

1
public abstract string Name { get; }

Property Value

String

Methods

Apply(LLamaTokenDataArrayNative&)

Apply this stage to a set of logits. This can modify logits or select a token (or both). If logits are modified the Sorted flag must be set to false.

1
void Apply(LLamaTokenDataArrayNative& tokenData)

Parameters

tokenData LLamaTokenDataArrayNative&

Remarks:

If the logits are no longer sorted after the custom sampler has run it is critically important to set Sorted=false. If unsure, always set it to false, this is a safe default.

Accept(LLamaToken)

Update the internal state of the sampler when a token is chosen

1
void Accept(LLamaToken token)

Parameters

token LLamaToken

Reset()

Reset the internal state of this sampler

1
void Reset()

Clone()

Create a clone of this sampler

1
ICustomSampler Clone()

Returns

ICustomSampler


< Back