pub struct TrainerBuilder { /* private fields */ }Expand description
Builder for constructing a Trainer with sensible defaults.
Implementations§
Source§impl TrainerBuilder
impl TrainerBuilder
Sourcepub fn vocab_size(self, size: usize) -> Self
pub fn vocab_size(self, size: usize) -> Self
Sets the vocabulary size (required).
This is the number of distinct token IDs your tokenizer produces.
Sourcepub fn budget(self, budget: ParameterBudget) -> Self
pub fn budget(self, budget: ParameterBudget) -> Self
Sets the parameter budget. Defaults to ParameterBudget::Params10M.
Sourcepub fn device(self, device: Device) -> Self
pub fn device(self, device: Device) -> Self
Sets the compute device. Defaults to default_device().
Sourcepub fn batch_size(self, size: usize) -> Self
pub fn batch_size(self, size: usize) -> Self
Sets the batch size. Defaults to 4.
Sourcepub fn learning_rate(self, lr: f64) -> Self
pub fn learning_rate(self, lr: f64) -> Self
Sets the learning rate. Defaults to 2e-4.
Sourcepub fn weight_decay(self, wd: f64) -> Self
pub fn weight_decay(self, wd: f64) -> Self
Sets the weight decay. Defaults to 0.01.
Sourcepub fn grad_clip_norm(self, norm: Option<f64>) -> Self
pub fn grad_clip_norm(self, norm: Option<f64>) -> Self
Sets gradient clip norm. Defaults to Some(1.0).
Sourcepub fn checkpoint_dir(self, dir: impl Into<String>) -> Self
pub fn checkpoint_dir(self, dir: impl Into<String>) -> Self
Sets the directory where checkpoints are saved.
Sourcepub fn checkpoint_interval(self, steps: usize) -> Self
pub fn checkpoint_interval(self, steps: usize) -> Self
Sets how often (in steps) to save checkpoints. Defaults to 1000.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrainerBuilder
impl RefUnwindSafe for TrainerBuilder
impl Send for TrainerBuilder
impl Sync for TrainerBuilder
impl Unpin for TrainerBuilder
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more