pub struct TrainingConfig {
pub epochs: usize,
pub batch_size: usize,
pub gradient_accumulation_steps: usize,
pub learning_rate: f64,
pub lr_scheduler: LrScheduler,
pub warmup_ratio: f32,
pub weight_decay: f64,
pub max_grad_norm: f32,
pub save_steps: usize,
pub logging_steps: usize,
pub gradient_checkpointing: bool,
pub mixed_precision: bool,
}Expand description
Training hyperparameters.
§Example
use axolotl_rs::TrainingConfig;
use axolotl_rs::config::LrScheduler;
let training = TrainingConfig {
epochs: 3,
batch_size: 4,
learning_rate: 2e-4,
lr_scheduler: LrScheduler::Cosine,
warmup_ratio: 0.03,
gradient_accumulation_steps: 4,
..Default::default()
};
assert_eq!(training.epochs, 3);
assert_eq!(training.batch_size, 4);Fields§
§epochs: usizeNumber of training epochs.
batch_size: usizeBatch size per device.
gradient_accumulation_steps: usizeGradient accumulation steps.
learning_rate: f64Learning rate.
lr_scheduler: LrSchedulerLearning rate scheduler.
warmup_ratio: f32Warmup ratio.
weight_decay: f64Weight decay.
max_grad_norm: f32Maximum gradient norm for clipping.
save_steps: usizeSave checkpoint every N steps.
logging_steps: usizeLog every N steps.
gradient_checkpointing: boolUse gradient checkpointing.
mixed_precision: boolUse mixed precision training.
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
Source§impl Default for TrainingConfig
impl Default for TrainingConfig
Source§fn default() -> TrainingConfig
fn default() -> TrainingConfig
Returns the “default value” for a type. Read more
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>,
Deserialize this value from the given Serde deserializer. Read more
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for TrainingConfig
impl RefUnwindSafe for TrainingConfig
impl Send for TrainingConfig
impl Sync for TrainingConfig
impl Unpin 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> 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>
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