Sampler

Trait Sampler 

Source
pub trait Sampler {
    // Required methods
    fn init(&mut self, model_tokens: &[u32]);
    fn transform(&self, output: &mut [f32]);
    fn sample(&mut self, probs: &[f32]) -> u32;
}

Required Methods§

Source

fn init(&mut self, model_tokens: &[u32])

Initialize the sampler state.

Source

fn transform(&self, output: &mut [f32])

Update the raw model output.

Source

fn sample(&mut self, probs: &[f32]) -> u32

Select one token from the distribution, and also update the state.

Implementors§