class Llama::Sampler::TempExt

Overview

Extended Temperature sampler

The Extended Temperature sampler provides more control over temperature sampling with additional parameters for dynamic temperature adjustment. This is based on the paper "Dynamic Temperature for Language Models" (https://arxiv.org/abs/2309.02772).

Example:

# Create a temperature sampler with base temp 0.8, delta 0.5, and exponent 1.0
sampler = Llama::Sampler::TempExt.new(0.8, 0.5, 1.0)

Defined in:

llama/sampler/temp_ext.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(t : Float32, delta : Float32, exponent : Float32) #

Creates a new Extended Temperature sampler

Parameters:

  • t: Base temperature value
  • delta: Temperature delta for dynamic adjustment
  • exponent: Exponent for the temperature formula

Raises:

  • Llama::Error if the sampler cannot be created

[View source]