Struct tokenizers::models::wordpiece::WordPiece
source · pub struct WordPiece {
pub unk_token: String,
pub continuing_subword_prefix: String,
pub max_input_chars_per_word: usize,
/* private fields */
}
Expand description
A WordPiece model.
Fields§
§unk_token: String
§continuing_subword_prefix: String
§max_input_chars_per_word: usize
Implementations§
source§impl WordPiece
impl WordPiece
Trait Implementations§
source§impl<'de> Deserialize<'de> for WordPiece
impl<'de> Deserialize<'de> for WordPiece
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<WordPiece> for ModelWrapper
impl From<WordPiece> for ModelWrapper
source§impl Model for WordPiece
impl Model for WordPiece
type Trainer = WordPieceTrainer
source§fn get_vocab(&self) -> HashMap<String, u32>
fn get_vocab(&self) -> HashMap<String, u32>
Retrieve the entire vocabulary mapping (token -> ID)
source§fn get_vocab_size(&self) -> usize
fn get_vocab_size(&self) -> usize
Retrieve the size of the vocabulary
source§fn tokenize(&self, sequence: &str) -> Result<Vec<Token>>
fn tokenize(&self, sequence: &str) -> Result<Vec<Token>>
Tokenize the given sequence into multiple underlying
Token
. The offsets
on the Token
are expected to be relative to the given sequence.source§fn save(&self, folder: &Path, name: Option<&str>) -> Result<Vec<PathBuf>>
fn save(&self, folder: &Path, name: Option<&str>) -> Result<Vec<PathBuf>>
Save the current
Model
in the given folder, using the given prefix
for the various
files that need to be saved.source§fn get_trainer(&self) -> Self::Trainer
fn get_trainer(&self) -> Self::Trainer
Get an instance of a Trainer capable of training this Model
source§impl PartialEq for WordPiece
impl PartialEq for WordPiece
impl Eq for WordPiece
impl StructuralPartialEq for WordPiece
Auto Trait Implementations§
impl Freeze for WordPiece
impl RefUnwindSafe for WordPiece
impl Send for WordPiece
impl Sync for WordPiece
impl Unpin for WordPiece
impl UnwindSafe for WordPiece
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