pub struct TrainingConfig {Show 15 fields
pub vocabulary_id: VocabularyId,
pub vocabulary_version: Version,
pub vocab_size: u32,
pub min_frequency: u64,
pub pretokenizer: Pretokenizer,
pub reserved_tokens: Vec<String>,
pub max_token_length: Option<usize>,
pub train_window: usize,
pub dictionary: Vec<String>,
pub max_corpus_units: Option<u64>,
pub seed: u64,
pub description: Option<String>,
pub license: Option<String>,
pub embed_test_vectors: bool,
pub stream_bytes: Option<usize>,
}Expand description
Everything a training run needs. Identical configuration and corpus must produce an identical vocabulary (FR-003 deterministic mode is the only mode in v0.1).
Fields§
§vocabulary_id: VocabularyId§vocabulary_version: Version§vocab_size: u32Target total number of tokens, including base and reserved tokens.
min_frequency: u64A candidate must occur at least this often to become a token.
pretokenizer: Pretokenizer§reserved_tokens: Vec<String>Special tokens appended after learned tokens. Never produced by encode.
max_token_length: Option<usize>Upper bound on a learned token’s length in units (bytes or symbols).
train_window: usizeWindow length used to split unsegmented input while counting.
dictionary: Vec<String>Fixed entries for the dictionary algorithm.
max_corpus_units: Option<u64>Job limit: refuse a corpus larger than this many units.
seed: u64Recorded for provenance. No v0.1 algorithm consumes randomness.
description: Option<String>§license: Option<String>§embed_test_vectors: boolStore short samples of the training corpus in the vocabulary as self-test vectors. Off unless asked for: the vectors are verbatim excerpts of the corpus, and a vocabulary file is what gets published. Absent means off, for a configuration someone writes by hand as much as for one built in code. Vocabularies trained before v0.4.0 recorded nothing here when vectors were on; whether a vocabulary has vectors is read from the vocabulary, not from this field.
stream_bytes: Option<usize>When training from files, read them in pieces of about this many bytes, cut at a line break, instead of whole. Each piece is one record, so memory no longer grows with file size. The value is part of the configuration because it decides where records end.
Implementations§
Source§impl TrainingConfig
impl TrainingConfig
pub fn new(vocabulary_id: VocabularyId, vocab_size: u32) -> TrainingConfig
pub fn validate(&self) -> Result<(), KuteError>
Trait Implementations§
Source§impl Clone for TrainingConfig
impl Clone for TrainingConfig
Source§fn clone(&self) -> TrainingConfig
fn clone(&self) -> TrainingConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TrainingConfig
impl Debug for TrainingConfig
Source§impl<'de> Deserialize<'de> for TrainingConfig
impl<'de> Deserialize<'de> for TrainingConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TrainingConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TrainingConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for TrainingConfig
impl PartialEq for TrainingConfig
Source§impl Serialize for TrainingConfig
impl Serialize for TrainingConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for TrainingConfig
Auto Trait Implementations§
impl Forget for TrainingConfig
impl Freeze for TrainingConfig
impl Move for TrainingConfig
impl RefUnwindSafe for TrainingConfig
impl Send for TrainingConfig
impl Sync for TrainingConfig
impl Unpin for TrainingConfig
impl UnsafeUnpin for TrainingConfig
impl UnwindSafe for TrainingConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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