pub trait Sampler:
Debug
+ Send
+ Sync {
// Required method
fn apply(
&self,
logits: Logits<'_>,
history: &[u32],
state: &mut SamplerState,
rng: &mut Philox4x32,
);
// Provided method
fn name(&self) -> &'static str { ... }
}Expand description
A logit transform + sample step. Samplers mutate the logits row in place;
sample is called at the end of the chain.
Required Methods§
Sourcefn apply(
&self,
logits: Logits<'_>,
history: &[u32],
state: &mut SamplerState,
rng: &mut Philox4x32,
)
fn apply( &self, logits: Logits<'_>, history: &[u32], state: &mut SamplerState, rng: &mut Philox4x32, )
Apply this sampler’s transformation to logits. history is the
already-emitted token sequence (newest last). Some samplers (DRY,
repetition penalty) need it; pure logit transforms ignore it.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".