abstract class
Llama::Sampler::Base
- Llama::Sampler::Base
- Reference
- Object
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
- Llama::Sampler::AdaptiveP
- Llama::Sampler::Dist
- Llama::Sampler::Grammar
- Llama::Sampler::GrammarLazyPatterns
- Llama::Sampler::Greedy
- Llama::Sampler::Infill
- Llama::Sampler::MinP
- Llama::Sampler::Mirostat
- Llama::Sampler::MirostatV2
- Llama::Sampler::Penalties
- Llama::Sampler::Temp
- Llama::Sampler::TempExt
- Llama::Sampler::TopK
- Llama::Sampler::TopNSigma
- Llama::Sampler::TopP
- Llama::Sampler::Typical
- Llama::Sampler::Xtc
Defined in:
llama/sampler/base.crConstructors
-
.new(handle : Pointer(LibLlama::LlamaSampler))
Creates a new Sampler instance from a raw pointer.
Instance Method Summary
-
#close : Nil
Releases this sampler when it is not owned by a chain.
-
#closed? : Bool
Returns whether the sampler's native handle has been released.
-
#free : Nil
Releases the underlying C resources.
-
#to_unsafe : Pointer(Llama::LibLlama::LlamaSampler)
Returns the raw pointer to the underlying llama_sampler structure.
-
#unsafe_handle! : Pointer(LibLlama::LlamaSampler)
Returns a checked native handle for internal wrapper use.
Constructor Detail
Creates a new Sampler instance from a raw pointer.
Note: This constructor is intended for internal use.
Instance Method Detail
Releases the underlying C resources.
Calling this method multiple times is safe. A sampler owned by a SamplerChain is released with the chain instead.
Returns the raw pointer to the underlying llama_sampler structure.
Returns a checked native handle for internal wrapper use. :nodoc: