pub struct CheckpointingOptimizer<T> { /* private fields */ }Expand description
Wrapper optimizer that adds checkpointing support
Implementations§
Source§impl<T> CheckpointingOptimizer<T>where
T: CheckpointSupport,
impl<T> CheckpointingOptimizer<T>where
T: CheckpointSupport,
Sourcepub fn new(inner: T, config: CheckpointConfig) -> Result<Self, OptimizerError>
pub fn new(inner: T, config: CheckpointConfig) -> Result<Self, OptimizerError>
Create a new checkpointing optimizer wrapper
Sourcepub fn set_auto_checkpoint(&mut self, enabled: bool)
pub fn set_auto_checkpoint(&mut self, enabled: bool)
Enable or disable automatic checkpointing
Sourcepub fn checkpoint_manager(&self) -> &CheckpointManager
pub fn checkpoint_manager(&self) -> &CheckpointManager
Get the checkpoint manager
Sourcepub fn checkpoint_manager_mut(&mut self) -> &mut CheckpointManager
pub fn checkpoint_manager_mut(&mut self) -> &mut CheckpointManager
Get the checkpoint manager mutably
Sourcepub fn save_checkpoint(
&mut self,
loss: Option<f32>,
learning_rate: f32,
epoch: Option<usize>,
) -> Result<PathBuf, OptimizerError>
pub fn save_checkpoint( &mut self, loss: Option<f32>, learning_rate: f32, epoch: Option<usize>, ) -> Result<PathBuf, OptimizerError>
Manually save a checkpoint
Sourcepub fn resume_from_latest(&mut self) -> Result<bool, OptimizerError>
pub fn resume_from_latest(&mut self) -> Result<bool, OptimizerError>
Resume from the latest checkpoint
Auto Trait Implementations§
impl<T> Freeze for CheckpointingOptimizer<T>where
T: Freeze,
impl<T> RefUnwindSafe for CheckpointingOptimizer<T>where
T: RefUnwindSafe,
impl<T> Send for CheckpointingOptimizer<T>where
T: Send,
impl<T> Sync for CheckpointingOptimizer<T>where
T: Sync,
impl<T> Unpin for CheckpointingOptimizer<T>where
T: Unpin,
impl<T> UnsafeUnpin for CheckpointingOptimizer<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for CheckpointingOptimizer<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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