pub struct TrainingConfig {
pub epochs: usize,
pub batch_size: usize,
pub learning_rate: f32,
pub gradient_clip_norm: Option<f32>,
pub gradient_accumulation_steps: usize,
pub log_every: usize,
pub eval_every: usize,
pub save_checkpoints: bool,
pub checkpoint_dir: String,
pub mixed_precision: bool,
pub seed: Option<u64>,
}Expand description
Configuration for training.
Fields§
§epochs: usizeNumber of training epochs
batch_size: usizeBatch size
learning_rate: f32Learning rate
gradient_clip_norm: Option<f32>Gradient clipping max norm (None = no clipping)
gradient_accumulation_steps: usizeNumber of gradient accumulation steps
log_every: usizeLogging frequency (steps)
eval_every: usizeEvaluation frequency (epochs)
save_checkpoints: boolSave checkpoints
checkpoint_dir: StringCheckpoint directory
mixed_precision: boolUse mixed precision training
seed: Option<u64>Seed for reproducibility
Implementations§
Source§impl TrainingConfig
impl TrainingConfig
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Builder: set batch size.
Sourcepub fn learning_rate(self, lr: f32) -> Self
pub fn learning_rate(self, lr: f32) -> Self
Builder: set learning rate.
Sourcepub fn gradient_clip_norm(self, max_norm: f32) -> Self
pub fn gradient_clip_norm(self, max_norm: f32) -> Self
Builder: set gradient clipping.
Sourcepub fn gradient_accumulation_steps(self, steps: usize) -> Self
pub fn gradient_accumulation_steps(self, steps: usize) -> Self
Builder: set gradient accumulation steps.
Sourcepub fn mixed_precision(self, enabled: bool) -> Self
pub fn mixed_precision(self, enabled: bool) -> Self
Builder: enable mixed precision.
Trait Implementations§
Source§impl Clone for TrainingConfig
impl Clone for TrainingConfig
Source§fn clone(&self) -> TrainingConfig
fn clone(&self) -> TrainingConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrainingConfig
impl Debug for TrainingConfig
Auto Trait Implementations§
impl Freeze 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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