pub struct MockSampler;Expand description
Greedy sampler — always picks the token with highest logit. Deterministic, no temperature or top-k.
Trait Implementations§
Source§impl Sampler for MockSampler
impl Sampler for MockSampler
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, FerrumError>
fn sample_with_context( &self, ctx: &SamplingContext<'_>, rng: &mut dyn RngCore, ) -> Result<TokenId, FerrumError>
Sample with additional context (default implementation ignores context)
Auto Trait Implementations§
impl Freeze for MockSampler
impl RefUnwindSafe for MockSampler
impl Send for MockSampler
impl Sync for MockSampler
impl Unpin for MockSampler
impl UnsafeUnpin for MockSampler
impl UnwindSafe for MockSampler
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