Struct tokenizers::models::bpe::BpeBuilder

source ·
pub struct BpeBuilder { /* private fields */ }
Expand description

A BpeBuilder can be used to create a BPE model with a custom configuration.

Implementations§

source§

impl BpeBuilder

source

pub fn new() -> Self

Constructs a new BpeBuilder.

source

pub fn files(self, vocab: String, merges: String) -> Self

Set the input files.

source

pub fn vocab_and_merges(self, vocab: Vocab, merges: Merges) -> Self

Set the vocab (token -> ID) and merges mappings.

source

pub fn cache_capacity(self, capacity: usize) -> Self

Set the cache’s capacity. Set to 0 if you want to disable caching.

source

pub fn dropout(self, dropout: f32) -> Self

Use dropout with the model.

source

pub fn unk_token(self, unk_token: String) -> Self

Set the UNK token for the vocab.

source

pub fn continuing_subword_prefix(self, prefix: String) -> Self

Set the continuing_subword_prefix option.

source

pub fn end_of_word_suffix(self, prefix: String) -> Self

Set the end_of_word_suffix option.

source

pub fn fuse_unk(self, fuse_unk: bool) -> Self

Set the fuse_unk option.

source

pub fn byte_fallback(self, byte_fallback: bool) -> Self

Set the byte_fallback option.

source

pub fn build(self) -> Result<BPE>

Returns a BPE model that uses the BpeBuilder’s configuration.

Trait Implementations§

source§

impl Default for BpeBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V