pub struct TrainingCheckpoint<B: Backend> {
pub model_params: Vec<(String, Tensor<B>)>,
pub optimizer_state: Option<OptimizerState>,
pub epoch: u64,
pub global_step: u64,
pub best_loss: f64,
pub loss_history: Vec<f64>,
}Expand description
Complete training checkpoint: model weights + optimizer state + training metadata.
Enables full training resume — not just the model parameters, but all the internal state that would be lost if training were interrupted.
Fields§
§model_params: Vec<(String, Tensor<B>)>Named model parameters (same as standard checkpoint).
optimizer_state: Option<OptimizerState>Optimizer internal state (momentum buffers, step counters, etc.)
epoch: u64Current training epoch (0-indexed).
global_step: u64Global optimization step counter.
best_loss: f64Best loss value seen during training.
loss_history: Vec<f64>Per-epoch loss history.
Implementations§
Source§impl<B: Backend> TrainingCheckpoint<B>
impl<B: Backend> TrainingCheckpoint<B>
Sourcepub fn from_executor(executor: &Executor<B>) -> Self
pub fn from_executor(executor: &Executor<B>) -> Self
Create a checkpoint from an executor (model params only).
Sourcepub fn with_optimizer_state(self, state: OptimizerState) -> Self
pub fn with_optimizer_state(self, state: OptimizerState) -> Self
Set the optimizer state in this checkpoint.
Sourcepub fn with_epoch(self, epoch: u64) -> Self
pub fn with_epoch(self, epoch: u64) -> Self
Set epoch counter.
Sourcepub fn with_global_step(self, step: u64) -> Self
pub fn with_global_step(self, step: u64) -> Self
Set global step counter.
Sourcepub fn with_best_loss(self, loss: f64) -> Self
pub fn with_best_loss(self, loss: f64) -> Self
Set best loss.
Sourcepub fn with_loss_history(self, history: Vec<f64>) -> Self
pub fn with_loss_history(self, history: Vec<f64>) -> Self
Set loss history.
Trait Implementations§
Source§impl<B: Clone + Backend> Clone for TrainingCheckpoint<B>
impl<B: Clone + Backend> Clone for TrainingCheckpoint<B>
Source§fn clone(&self) -> TrainingCheckpoint<B>
fn clone(&self) -> TrainingCheckpoint<B>
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 moreAuto Trait Implementations§
impl<B> Freeze for TrainingCheckpoint<B>
impl<B> RefUnwindSafe for TrainingCheckpoint<B>
impl<B> Send for TrainingCheckpoint<B>
impl<B> Sync for TrainingCheckpoint<B>
impl<B> Unpin for TrainingCheckpoint<B>
impl<B> UnwindSafe for TrainingCheckpoint<B>
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