pub struct TrainerBuilder { /* private fields */ }Expand description
Builder for TrainerConfig.
Implementations§
Source§impl TrainerBuilder
impl TrainerBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a builder with TrainerConfig::default settings.
Sourcepub fn target_vocab_size(self, value: usize) -> Self
pub fn target_vocab_size(self, value: usize) -> Self
Sets the desired vocabulary size (including base byte tokens).
Sourcepub fn min_frequency(self, value: usize) -> Self
pub fn min_frequency(self, value: usize) -> Self
Sets the minimum merge frequency.
Sourcepub fn allowed_token_lengths<I>(self, lengths: I) -> Selfwhere
I: IntoIterator<Item = usize>,
pub fn allowed_token_lengths<I>(self, lengths: I) -> Selfwhere
I: IntoIterator<Item = usize>,
Overrides the allowed token lengths.
Sourcepub fn show_progress(self, enabled: bool) -> Self
pub fn show_progress(self, enabled: bool) -> Self
Enables or disables per-iteration logging.
Sourcepub fn special_tokens<I, S>(self, tokens: I) -> Self
pub fn special_tokens<I, S>(self, tokens: I) -> Self
Appends custom special tokens after the built-in required tokens.
Sourcepub fn append_special_tokens<I, S>(self, tokens: I) -> Self
pub fn append_special_tokens<I, S>(self, tokens: I) -> Self
Appends additional special tokens after the reasoning set (preserves order, deduplicated in build).
Sourcepub fn plateau_thresholds(
self,
floor: usize,
patience: usize,
divisor: usize,
) -> Self
pub fn plateau_thresholds( self, floor: usize, patience: usize, divisor: usize, ) -> Self
Configures plateau-based early stopping thresholds.
Sourcepub fn plateau_stop_enabled(self, enabled: bool) -> Self
pub fn plateau_stop_enabled(self, enabled: bool) -> Self
Enables plateau-based early stopping.
Sourcepub fn max_merge_iterations(self, value: Option<usize>) -> Self
pub fn max_merge_iterations(self, value: Option<usize>) -> Self
Sets a hard merge iteration limit.
Sourcepub fn preprocessor(self, config: PreprocessorConfig) -> Self
pub fn preprocessor(self, config: PreprocessorConfig) -> Self
Configures the preprocessing mode applied before training.
Sourcepub fn require_letter_whitespace_merges(self, enabled: bool) -> Self
pub fn require_letter_whitespace_merges(self, enabled: bool) -> Self
Enforces that whitespace-containing merges include ASCII letters when enabled.
Sourcepub fn forbid_leading_whitespace_merges(self, enabled: bool) -> Self
pub fn forbid_leading_whitespace_merges(self, enabled: bool) -> Self
Forbids merges that would introduce leading ASCII whitespace unless the token is pure whitespace.
Sourcepub fn reasoning_tokens_enabled(self, enabled: bool) -> Self
pub fn reasoning_tokens_enabled(self, enabled: bool) -> Self
Enables or disables the optional reasoning/argument special tokens.
Sourcepub fn preprocessor_split_probability(self, probability: f64) -> Self
pub fn preprocessor_split_probability(self, probability: f64) -> Self
Overrides only the preprocessor split probability.
Sourcepub fn preprocessor_seed(self, seed: Option<u64>) -> Self
pub fn preprocessor_seed(self, seed: Option<u64>) -> Self
Sets an optional RNG seed for probabilistic preprocessing.
Sourcepub fn build(self) -> Result<TrainerConfig>
pub fn build(self) -> Result<TrainerConfig>
Finalises the builder, returning a validated TrainerConfig.
Trait Implementations§
Source§impl Clone for TrainerBuilder
impl Clone for TrainerBuilder
Source§fn clone(&self) -> TrainerBuilder
fn clone(&self) -> TrainerBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TrainerBuilder
impl Debug for TrainerBuilder
Auto Trait Implementations§
impl Freeze for TrainerBuilder
impl RefUnwindSafe for TrainerBuilder
impl Send for TrainerBuilder
impl Sync for TrainerBuilder
impl Unpin for TrainerBuilder
impl UnwindSafe for TrainerBuilder
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