pub struct OptimizerState {
pub step: u64,
pub buffers: Vec<(String, Vec<f32>)>,
}Expand description
An optimizer’s internal state, for checkpointing a training run.
buffers are the per-parameter accumulators keyed "<slot>/<param>" — Adam
writes "m/w1" and "v/w1" — so a reload can match them back up by name
even if the parameter order changed. step is the bias-correction counter.
Resuming without this is not resuming: Adam’s moments are most of what it knows, and restarting them at zero produces a loss spike and a different trajectory from the one that was interrupted.
Fields§
§step: u64§buffers: Vec<(String, Vec<f32>)>Implementations§
Trait Implementations§
Source§impl Clone for OptimizerState
impl Clone for OptimizerState
Source§impl Debug for OptimizerState
impl Debug for OptimizerState
Source§impl Default for OptimizerState
impl Default for OptimizerState
Source§impl PartialEq for OptimizerState
impl PartialEq for OptimizerState
impl StructuralPartialEq for OptimizerState
Auto Trait Implementations§
impl Freeze for OptimizerState
impl RefUnwindSafe for OptimizerState
impl Send for OptimizerState
impl Sync for OptimizerState
impl Unpin for OptimizerState
impl UnsafeUnpin for OptimizerState
impl UnwindSafe for OptimizerState
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