pub enum VocabMismatch {
Size {
draft: usize,
target: usize,
},
}Expand description
The draft and target checkpoints do not agree about token ids.
This is the failure that costs a day, because it does not look like
a failure. The rejection rule compares the drafter’s q(x) with the
target’s p(x) at the same index x. If the two checkpoints number
their vocabularies differently, those are probabilities of different
tokens, the rule is comparing unrelated numbers, and the output is
no longer the target’s distribution. What comes out is fluent text,
with no error and a plausible-looking accept rate.
So it is refused at construction, which per this repo’s rule is coverage rather than a defect: a partly-implemented thing must stop and say what is missing instead of computing something else.
Vocabulary size is checked first because it is cheap and catches
most real mismatches (a 32000-token Llama drafter against a
152064-token Qwen target). Equal sizes do not imply equal
vocabularies, though, so the caller that has both tokenizers should
also compare them; vocab_size is what a Decoder alone can see.
Variants§
Trait Implementations§
Source§impl Clone for VocabMismatch
impl Clone for VocabMismatch
Source§fn clone(&self) -> VocabMismatch
fn clone(&self) -> VocabMismatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VocabMismatch
impl Debug for VocabMismatch
Source§impl Display for VocabMismatch
impl Display for VocabMismatch
impl Eq for VocabMismatch
Source§impl Error for VocabMismatch
impl Error for VocabMismatch
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 PartialEq for VocabMismatch
impl PartialEq for VocabMismatch
impl StructuralPartialEq for VocabMismatch
Auto Trait Implementations§
impl Freeze for VocabMismatch
impl RefUnwindSafe for VocabMismatch
impl Send for VocabMismatch
impl Sync for VocabMismatch
impl Unpin for VocabMismatch
impl UnsafeUnpin for VocabMismatch
impl UnwindSafe for VocabMismatch
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