#[repr(u32)]pub enum VocabType {
BPE = 2,
SPM = 1,
}Expand description
Defines the possible types of vocabulary used by the model.
The model may use different types of vocabulary depending on the tokenization method chosen during training.
This enum represents these types, specifically BPE (Byte Pair Encoding) and SPM (SentencePiece).
§Variants
BPE: Byte Pair Encoding, a common tokenization method used in NLP tasks.SPM:SentencePiece, another popular tokenization method for NLP models.
§Example
use llama_cpp_4::model::VocabType;
let vocab_type = VocabType::BPE;
match vocab_type {
VocabType::BPE => println!("The model uses Byte Pair Encoding (BPE)"),
VocabType::SPM => println!("The model uses SentencePiece (SPM)"),
}Variants§
Trait Implementations§
Source§impl TryFrom<u32> for VocabType
impl TryFrom<u32> for VocabType
Source§type Error = LlamaTokenTypeFromIntError
type Error = LlamaTokenTypeFromIntError
The type returned in the event of a conversion error.
impl Copy for VocabType
impl Eq for VocabType
impl StructuralPartialEq for VocabType
Auto Trait Implementations§
impl Freeze for VocabType
impl RefUnwindSafe for VocabType
impl Send for VocabType
impl Sync for VocabType
impl Unpin for VocabType
impl UnsafeUnpin for VocabType
impl UnwindSafe for VocabType
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