pub struct MixedPrecisionConfig {
pub compute_precision: PrecisionMode,
pub master_precision: PrecisionMode,
pub loss_scale: f32,
pub dynamic_loss_scale: bool,
pub min_loss_scale: f32,
pub max_loss_scale: f32,
pub scale_growth_factor: f32,
pub scale_backoff_factor: f32,
pub scale_growth_interval: usize,
}Expand description
Mixed precision training configuration.
Fields§
§compute_precision: PrecisionModePrecision mode for computation
master_precision: PrecisionModePrecision mode for master weights (usually FP32)
loss_scale: f32Loss scale factor to prevent gradient underflow
dynamic_loss_scale: boolEnable dynamic loss scaling
min_loss_scale: f32Minimum loss scale for dynamic scaling
max_loss_scale: f32Maximum loss scale for dynamic scaling
scale_growth_factor: f32Growth factor for dynamic loss scaling
scale_backoff_factor: f32Backoff factor for dynamic loss scaling
scale_growth_interval: usizeNumber of consecutive non-overflow steps before increasing scale
Implementations§
Source§impl MixedPrecisionConfig
impl MixedPrecisionConfig
Sourcepub fn new(compute_precision: PrecisionMode) -> MixedPrecisionConfig
pub fn new(compute_precision: PrecisionMode) -> MixedPrecisionConfig
Create a new mixed precision configuration.
Sourcepub fn fp16() -> MixedPrecisionConfig
pub fn fp16() -> MixedPrecisionConfig
Create a configuration for FP16 training.
Sourcepub fn bf16() -> MixedPrecisionConfig
pub fn bf16() -> MixedPrecisionConfig
Create a configuration for BF16 training.
Sourcepub fn fp32() -> MixedPrecisionConfig
pub fn fp32() -> MixedPrecisionConfig
Create a configuration for FP32 training (no mixed precision).
Trait Implementations§
Source§impl Clone for MixedPrecisionConfig
impl Clone for MixedPrecisionConfig
Source§fn clone(&self) -> MixedPrecisionConfig
fn clone(&self) -> MixedPrecisionConfig
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 MixedPrecisionConfig
impl Debug for MixedPrecisionConfig
Source§impl Default for MixedPrecisionConfig
impl Default for MixedPrecisionConfig
Source§fn default() -> MixedPrecisionConfig
fn default() -> MixedPrecisionConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MixedPrecisionConfig
impl RefUnwindSafe for MixedPrecisionConfig
impl Send for MixedPrecisionConfig
impl Sync for MixedPrecisionConfig
impl Unpin for MixedPrecisionConfig
impl UnwindSafe for MixedPrecisionConfig
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