[][src]Struct rust_tokenizers::vocab::T5Vocab

pub struct T5Vocab {
    pub values: HashMap<String, i64>,
    pub indices: HashMap<i64, String>,
    pub unknown_value: &'static str,
    pub special_values: HashMap<String, i64>,
    pub special_indices: HashMap<i64, String>,
}

T5 Vocab

Vocabulary for T5 tokenizer. Contains the following special values:

  • PAD token
  • EOS token

Expects a SentencePiece protobuf file when created from file.

Fields

values: HashMap<String, i64>

A mapping of tokens as string to indices (i.e. the encoder base)

indices: HashMap<i64, String>

A mapping of token ids to strings (i.e. the decoder base)

unknown_value: &'static str

The string to use for unknown (out of vocabulary) tokens

special_values: HashMap<String, i64>

A mapping of special value tokens as strings to IDs (i.e. the encoder base for special values), special values typically include things like BOS/EOS markers, class markers, mask markers and padding markers

special_indices: HashMap<i64, String>

A mapping of special value tokens as IDs to strings (i.e. the decoder base for special values)

Implementations

impl T5Vocab[src]

pub fn eos_value() -> &'static str[src]

Returns the EOS token for T5 (<eos>)

pub fn pad_value() -> &'static str[src]

Returns the PAD token for T5 (<pad>)

Trait Implementations

impl Clone for T5Vocab[src]

impl Debug for T5Vocab[src]

impl MultiThreadedTokenizer<T5Vocab> for T5Tokenizer[src]

impl Tokenizer<T5Vocab> for T5Tokenizer[src]

impl Vocab for T5Vocab[src]

Auto Trait Implementations

impl RefUnwindSafe for T5Vocab

impl Send for T5Vocab

impl Sync for T5Vocab

impl Unpin for T5Vocab

impl UnwindSafe for T5Vocab

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.