Skip to main content

sample

Function sample 

Source
pub fn sample(logits: &[f32], config: &SamplingConfig, rng_seed: u64) -> u32
Expand description

Sample a token ID from logits using the given config.

logits is a slice of length vocab_size with raw (unnormalized) scores. Returns the selected token ID.