pub struct GreedySampler;Expand description
Common samplers Greedy sampler (always picks highest probability token)
Trait Implementations§
Source§impl Sampler for GreedySampler
impl Sampler for GreedySampler
Source§fn sample(&self, logits: &[f32], _rng: &mut dyn RngCore) -> Result<TokenId>
fn sample(&self, logits: &[f32], _rng: &mut dyn RngCore) -> Result<TokenId>
Sample next token from logits
Source§fn is_deterministic(&self) -> bool
fn is_deterministic(&self) -> bool
Whether this sampler is deterministic
Source§fn sample_with_context(
&self,
ctx: &SamplingContext<'_>,
rng: &mut dyn RngCore,
) -> Result<TokenId>
fn sample_with_context( &self, ctx: &SamplingContext<'_>, rng: &mut dyn RngCore, ) -> Result<TokenId>
Sample with additional context (default implementation ignores context)
Auto Trait Implementations§
impl Freeze for GreedySampler
impl RefUnwindSafe for GreedySampler
impl Send for GreedySampler
impl Sync for GreedySampler
impl Unpin for GreedySampler
impl UnsafeUnpin for GreedySampler
impl UnwindSafe for GreedySampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more