class Llama::Sampler::MirostatV2

Overview

Mirostat sampler (version 2)

The Mirostat V2 sampler is an improved version of the Mirostat algorithm that requires fewer parameters and is more efficient. It dynamically adjusts sampling to maintain a target entropy level.

Based on the paper: https://arxiv.org/abs/2007.14966

Example:

sampler = Llama::Sampler::MirostatV2.new(42, 5.0, 0.1)

Defined in:

llama/sampler/mirostat_v2.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, tau : Float32, eta : Float32) #

Creates a new Mirostat V2 sampler

Parameters:

  • seed: Random seed
  • tau: Target entropy (5.0 is a good default)
  • eta: Learning rate (0.1 is a good default)

Raises:

  • Llama::Error if the sampler cannot be created

[View source]