pub struct SamplerChain { /* private fields */ }Expand description
An ordered set of sampling stages with reusable candidate storage.
Implementations§
Source§impl SamplerChain
impl SamplerChain
Sourcepub fn push(self, sampler: impl Sampler + 'static) -> Self
pub fn push(self, sampler: impl Sampler + 'static) -> Self
Appends one concrete stage and returns the chain.
Sourcepub fn llama_default(config: ChainConfig) -> Self
pub fn llama_default(config: ChainConfig) -> Self
Builds the standard stage order from config.
Sourcepub fn sample(
&mut self,
logits: &mut [f32],
history: &[u32],
rng: &mut dyn Rng,
) -> Result<u32, Error>
pub fn sample( &mut self, logits: &mut [f32], history: &[u32], rng: &mut dyn Rng, ) -> Result<u32, Error>
Loads logits, runs every stage, and returns the selected token.
Sourcepub fn candidates(&self) -> &Candidates
pub fn candidates(&self) -> &Candidates
Returns the candidate set left by the most recent sample call.
Trait Implementations§
Source§impl Debug for SamplerChain
impl Debug for SamplerChain
Auto Trait Implementations§
impl !RefUnwindSafe for SamplerChain
impl !Sync for SamplerChain
impl !UnwindSafe for SamplerChain
impl Freeze for SamplerChain
impl Send for SamplerChain
impl Unpin for SamplerChain
impl UnsafeUnpin for SamplerChain
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