Skip to main content

sample_token

Function sample_token 

Source
pub fn sample_token(logits: &[f32], opts: SampleOpts) -> usize
Expand description

Sample one token id from a [vocab] logits slice. Returns the chosen index. Uses opts.seed only — prefer sample_token_at when generating multiple tokens from the same seed.