pub enum SpeculativeDecodingError {
VocabMismatch {
draft: usize,
target: usize,
},
DistributionWidthMismatch {
expected: usize,
got: usize,
},
DraftShapeMismatch {
tokens: usize,
logprobs: usize,
distributions: usize,
},
TargetShapeMismatch {
expected: usize,
got: usize,
},
InvalidConfig(String),
EmptyPrefix,
TokenOutOfRange {
token: usize,
vocab_size: usize,
},
DegenerateDistribution,
ModelError(String),
}Expand description
Errors that can be raised during speculative decoding.
Variants§
VocabMismatch
A draft and target model disagreed on vocab_size.
DistributionWidthMismatch
A distribution row had the wrong width.
DraftShapeMismatch
The draft model returned a proposal whose tokens / token_logprobs
/ distributions vectors disagreed in length.
TargetShapeMismatch
The target model returned the wrong number of distribution rows.
InvalidConfig(String)
The caller asked for k == 0 draft tokens (or similar degenerate
configuration).
EmptyPrefix
The caller supplied an empty prefix to generate even though the
configured models require at least one bos/sos token.
TokenOutOfRange
A token id produced by a model was outside the configured vocabulary.
DegenerateDistribution
A probability row collapsed to zero mass — typically because
max(0, p_target - p_draft) was identically zero on every index, which
happens iff p_target == p_draft everywhere. We fall back to the raw
target distribution in that case; this variant is reserved for cases
where even that is degenerate.
ModelError(String)
A model implementation returned a descriptive error.
Trait Implementations§
Source§impl Clone for SpeculativeDecodingError
impl Clone for SpeculativeDecodingError
Source§fn clone(&self) -> SpeculativeDecodingError
fn clone(&self) -> SpeculativeDecodingError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpeculativeDecodingError
impl Debug for SpeculativeDecodingError
Source§impl Display for SpeculativeDecodingError
impl Display for SpeculativeDecodingError
Source§impl Error for SpeculativeDecodingError
impl Error for SpeculativeDecodingError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<SpeculativeDecodingError> for TrustformerError
impl From<SpeculativeDecodingError> for TrustformerError
Source§fn from(err: SpeculativeDecodingError) -> Self
fn from(err: SpeculativeDecodingError) -> Self
Source§impl PartialEq for SpeculativeDecodingError
impl PartialEq for SpeculativeDecodingError
impl StructuralPartialEq for SpeculativeDecodingError
Auto Trait Implementations§
impl Freeze for SpeculativeDecodingError
impl RefUnwindSafe for SpeculativeDecodingError
impl Send for SpeculativeDecodingError
impl Sync for SpeculativeDecodingError
impl Unpin for SpeculativeDecodingError
impl UnsafeUnpin for SpeculativeDecodingError
impl UnwindSafe for SpeculativeDecodingError
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
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>
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>
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