pub struct LlamaDrySampler { /* private fields */ }Expand description
The stateful DRY repetition sampler.
Build with LlamaDrySampler::new, then apply it to the
candidate array before sampling and accept each drawn
token so its repetition history stays in sync.
Implementations§
Source§impl LlamaDrySampler
impl LlamaDrySampler
Sourcepub fn new(model: &LlamaModel, params: &DryParams) -> Result<Self, DryInitError>
pub fn new(model: &LlamaModel, params: &DryParams) -> Result<Self, DryInitError>
Build a DRY sampler for model from params.
§Errors
DryInitError::Nul if a sequence breaker contains an interior NUL
byte; DryInitError::Init if the C-side initializer returns null.
Sourcepub fn apply(
&mut self,
ctx: &mut LlamaContext<'_>,
arr: &mut LlamaTokenDataArray,
)
pub fn apply( &mut self, ctx: &mut LlamaContext<'_>, arr: &mut LlamaTokenDataArray, )
Apply the DRY penalty to arr in place, based on the accepted history.
Call this before sampling / drawing a token.
Sourcepub fn accept(&mut self, token: LlamaToken)
pub fn accept(&mut self, token: LlamaToken)
Record a drawn token in the sampler’s repetition history.
Trait Implementations§
Source§impl Debug for LlamaDrySampler
impl Debug for LlamaDrySampler
Source§impl Drop for LlamaDrySampler
impl Drop for LlamaDrySampler
Auto Trait Implementations§
impl !Send for LlamaDrySampler
impl !Sync for LlamaDrySampler
impl Freeze for LlamaDrySampler
impl RefUnwindSafe for LlamaDrySampler
impl Unpin for LlamaDrySampler
impl UnsafeUnpin for LlamaDrySampler
impl UnwindSafe for LlamaDrySampler
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