pub struct TrainingConfig {Show 16 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>,
pub resume_from: Option<Box<Vocabulary>>,
}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.
resume_from: Option<Box<Vocabulary>>Continue an earlier run instead of starting over. The vocabulary
given here must have been trained on the same corpus with the same
settings and a smaller vocab_size; its merges are kept and learning
goes on from where it stopped. The result is the vocabulary a single
run to the new size would have produced. Not part of the recorded
configuration: it changes how the result is reached, not the result.
Its merges are taken as given, so resume only from a vocabulary you
trained or trust.