abstract class Llama::Sampler::Base

Overview

Base class for all sampling methods. Sampling is the process of selecting the next token during text generation. This is an abstract class.

Included Modules

Direct Known Subclasses

Defined in:

llama/sampler/base.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(handle : Pointer(LibLlama::LlamaSampler)) #

Creates a new Sampler instance from a raw pointer.

Note: This constructor is intended for internal use.


[View source]

Instance Method Detail

def close : Nil #

Releases this sampler when it is not owned by a chain.


[View source]
def closed? : Bool #

Returns whether the sampler's native handle has been released.


[View source]
def free : Nil #

Releases the underlying C resources.

Calling this method multiple times is safe. A sampler owned by a SamplerChain is released with the chain instead.


[View source]
def to_unsafe : Pointer(Llama::LibLlama::LlamaSampler) #

Returns the raw pointer to the underlying llama_sampler structure.


[View source]
def unsafe_handle! : Pointer(LibLlama::LlamaSampler) #

Returns a checked native handle for internal wrapper use. :nodoc:


[View source]