#[non_exhaustive]pub enum SamplingMode {
Default,
Greedy,
TopK(u32),
TopP(f64),
}Expand description
Strategy used when sampling the next token.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Default
Defer to FoundationModels’ default sampling strategy.
Greedy
Always pick the highest-probability token. Deterministic.
TopK(u32)
Sample from the top-k most probable tokens.
TopP(f64)
Nucleus sampling: smallest set of tokens whose cumulative probability
exceeds p (must be in 0.0..=1.0).
Trait Implementations§
Source§impl Clone for SamplingMode
impl Clone for SamplingMode
Source§fn clone(&self) -> SamplingMode
fn clone(&self) -> SamplingMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SamplingMode
impl Debug for SamplingMode
Source§impl Default for SamplingMode
impl Default for SamplingMode
Source§fn default() -> SamplingMode
fn default() -> SamplingMode
Returns the “default value” for a type. Read more
Source§impl PartialEq for SamplingMode
impl PartialEq for SamplingMode
Source§fn eq(&self, other: &SamplingMode) -> bool
fn eq(&self, other: &SamplingMode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for SamplingMode
impl StructuralPartialEq for SamplingMode
Auto Trait Implementations§
impl Freeze for SamplingMode
impl RefUnwindSafe for SamplingMode
impl Send for SamplingMode
impl Sync for SamplingMode
impl Unpin for SamplingMode
impl UnsafeUnpin for SamplingMode
impl UnwindSafe for SamplingMode
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