class Llama::Sampler::Temp

Overview

Temperature sampler

The Temperature sampler adjusts the logits by dividing them by the temperature value. Higher temperatures (>1.0) make the distribution more uniform, leading to more random outputs. Lower temperatures (<1.0) make the distribution more peaked, leading to more deterministic outputs.

Example:

sampler = Llama::Sampler::Temp.new(0.8) # Slightly more deterministic than default

Defined in:

llama/sampler/temp.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(temp : Float32) #

Creates a new temperature sampler

Parameters:

  • temp: The temperature value (0.0 = greedy, 1.0 = normal, >1.0 = more random)

Raises:

  • Llama::Error if the sampler cannot be created

[View source]