pub struct SamplerChain {
pub steps: Vec<Box<dyn Sampler>>,
}Expand description
A linear chain of samplers terminated by a softmax + multinomial
draw. Build one with SamplerChain::builder or directly from a Vec.
Fields§
§steps: Vec<Box<dyn Sampler>>Implementations§
Source§impl SamplerChain
impl SamplerChain
pub fn new() -> Self
pub fn builder() -> SamplerChainBuilder
Sourcepub fn sample(
&self,
logits: Logits<'_>,
history: &[u32],
state: &mut SamplerState,
rng: &mut Philox4x32,
) -> u32
pub fn sample( &self, logits: Logits<'_>, history: &[u32], state: &mut SamplerState, rng: &mut Philox4x32, ) -> u32
Run every sampler in order over logits, then draw one token.
Trait Implementations§
Source§impl Debug for SamplerChain
impl Debug for SamplerChain
Auto Trait Implementations§
impl !RefUnwindSafe for SamplerChain
impl !UnwindSafe for SamplerChain
impl Freeze for SamplerChain
impl Send for SamplerChain
impl Sync 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more