pub struct TrainingConfig {Show 18 fields
pub device_config: DeviceConfig,
pub learning_rate: f64,
pub batch_size: usize,
pub epochs: usize,
pub weight_decay: f64,
pub grad_clip: Option<f32>,
pub beta1: f64,
pub beta2: f64,
pub eps: f64,
pub scheduler: Option<SchedulerType>,
pub track_metrics: bool,
pub log_interval: usize,
pub validation_split: f32,
pub early_stopping_patience: Option<usize>,
pub use_gradient_checkpointing: bool,
pub checkpoint_segment_size: Option<usize>,
pub mixed_precision: MixedPrecision,
pub loss_scale: f32,
}Expand description
Configuration for training
Fields§
§device_config: DeviceConfigDevice configuration (CPU/CUDA/Metal)
learning_rate: f64Learning rate (initial for schedulers)
batch_size: usizeBatch size
epochs: usizeNumber of epochs
weight_decay: f64Weight decay (L2 regularization)
grad_clip: Option<f32>Gradient clipping threshold
beta1: f64Beta1 for Adam optimizer
beta2: f64Beta2 for Adam optimizer
eps: f64Epsilon for Adam optimizer
scheduler: Option<SchedulerType>Learning rate scheduler type
track_metrics: boolEnable metrics tracking
log_interval: usizeLog interval (batches)
validation_split: f32Validation split (0.0 to 1.0)
early_stopping_patience: Option<usize>Early stopping patience (epochs)
use_gradient_checkpointing: boolEnable gradient checkpointing (saves memory by recomputing activations)
checkpoint_segment_size: Option<usize>Checkpoint every N layers (None = checkpoint all layers)
mixed_precision: MixedPrecisionMixed precision training mode
loss_scale: f32Loss scaling factor for mixed precision (to prevent underflow)
Implementations§
Source§impl TrainingConfig
impl TrainingConfig
Sourcepub fn with_scheduler(self, scheduler: SchedulerType) -> Self
pub fn with_scheduler(self, scheduler: SchedulerType) -> Self
Set scheduler type
Sourcepub fn without_metrics(self) -> Self
pub fn without_metrics(self) -> Self
Disable metrics tracking
Sourcepub fn with_validation_split(self, split: f32) -> Self
pub fn with_validation_split(self, split: f32) -> Self
Set validation split
Sourcepub fn with_early_stopping(self, patience: usize) -> Self
pub fn with_early_stopping(self, patience: usize) -> Self
Set early stopping patience
Sourcepub fn without_early_stopping(self) -> Self
pub fn without_early_stopping(self) -> Self
Disable early stopping
Sourcepub fn with_gradient_checkpointing(self, segment_size: Option<usize>) -> Self
pub fn with_gradient_checkpointing(self, segment_size: Option<usize>) -> Self
Enable gradient checkpointing for memory-efficient training
Sourcepub fn without_gradient_checkpointing(self) -> Self
pub fn without_gradient_checkpointing(self) -> Self
Disable gradient checkpointing
Sourcepub fn with_mixed_precision(self, mode: MixedPrecision, loss_scale: f32) -> Self
pub fn with_mixed_precision(self, mode: MixedPrecision, loss_scale: f32) -> Self
Set mixed precision mode
Sourcepub fn without_mixed_precision(self) -> Self
pub fn without_mixed_precision(self) -> Self
Disable mixed precision training
Trait Implementations§
Source§impl Clone for TrainingConfig
impl Clone for TrainingConfig
Source§fn clone(&self) -> TrainingConfig
fn clone(&self) -> TrainingConfig
1.0.0 · 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 Default for TrainingConfig
impl Default for TrainingConfig
Source§impl<'de> Deserialize<'de> for TrainingConfig
impl<'de> Deserialize<'de> for TrainingConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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