pub struct FixedDistDraftModel { /* private fields */ }Expand description
Draft model that always returns the same categorical distribution and samples tokens from it.
Implementations§
Source§impl FixedDistDraftModel
impl FixedDistDraftModel
Sourcepub fn new(probs: Vec<f64>) -> SpeculativeDecodingResult<Self>
pub fn new(probs: Vec<f64>) -> SpeculativeDecodingResult<Self>
Build a mock draft from a linear-space probability vector. The vector must be non-empty and sum to ≈ 1.
Trait Implementations§
Source§impl Clone for FixedDistDraftModel
impl Clone for FixedDistDraftModel
Source§fn clone(&self) -> FixedDistDraftModel
fn clone(&self) -> FixedDistDraftModel
Returns a duplicate of the value. Read more
1.0.0 · 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 FixedDistDraftModel
impl Debug for FixedDistDraftModel
Source§impl DraftModel for FixedDistDraftModel
impl DraftModel for FixedDistDraftModel
Source§fn vocab_size(&self) -> usize
fn vocab_size(&self) -> usize
Vocabulary cardinality the model emits log-probs over.
Source§fn propose(
&self,
_prefix: &[TokenId],
k: usize,
rng: &mut dyn SpecRng,
) -> SpeculativeDecodingResult<DraftProposal>
fn propose( &self, _prefix: &[TokenId], k: usize, rng: &mut dyn SpecRng, ) -> SpeculativeDecodingResult<DraftProposal>
Extend
prefix by k draft tokens; return the chosen tokens, their
log-probabilities and the full per-position distributions. Read moreAuto Trait Implementations§
impl Freeze for FixedDistDraftModel
impl RefUnwindSafe for FixedDistDraftModel
impl Send for FixedDistDraftModel
impl Sync for FixedDistDraftModel
impl Unpin for FixedDistDraftModel
impl UnsafeUnpin for FixedDistDraftModel
impl UnwindSafe for FixedDistDraftModel
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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