class Llama::Sampler::Dist

Overview

Distribution sampler (final sampler in a chain)

The Distribution sampler is typically the final sampler in a chain. It samples a token from the probability distribution after all other samplers have filtered the logits. This sampler is required to actually select a token from the distribution.

Example:

sampler = Llama::Sampler::Dist.new(42) # Use seed 42 for reproducibility

Defined in:

llama/sampler/dist.cr

Constructors

Instance methods inherited from class Llama::Sampler::Base

to_unsafe : Pointer(Llama::LibLlama::LlamaSampler) to_unsafe

Constructor methods inherited from class Llama::Sampler::Base

new(handle : Pointer(LibLlama::LlamaSampler)) new

Constructor Detail

def self.new(seed : UInt32 = LibLlama::LLAMA_DEFAULT_SEED) #

Creates a new distribution sampler

Parameters:

  • seed: Random seed for sampling (default: LLAMA_DEFAULT_SEED)

Raises:

  • Llama::Error if the sampler cannot be created

[View source]