pub struct TrainingRecord<B, M, O, S, U>{ /* private fields */ }std only.Expand description
One record containing the trainable state and a caller-defined continuation record.
Capture at a training boundary with no concurrent updates. The caller’s state carries its counters and any available input/RNG records; this type does not infer them or snapshot a DataLoader. Recorder precision settings apply to all component records and must preserve their values for exact continuation.
Implementations§
Source§impl<B, M, O, S, U> TrainingRecord<B, M, O, S, U>
impl<B, M, O, S, U> TrainingRecord<B, M, O, S, U>
Sourcepub fn capture(
model: &M,
optimizer: &O,
scheduler: &S,
accumulator: &GradientsAccumulator<M>,
state: U,
) -> Result<Self, RecorderError>
pub fn capture( model: &M, optimizer: &O, scheduler: &S, accumulator: &GradientsAccumulator<M>, state: U, ) -> Result<Self, RecorderError>
Capture the components without consuming the model or clearing gradients.
Sourcepub async fn capture_async(
model: &M,
optimizer: &O,
scheduler: &S,
accumulator: &GradientsAccumulator<M>,
state: U,
) -> Result<Self, RecorderError>
pub async fn capture_async( model: &M, optimizer: &O, scheduler: &S, accumulator: &GradientsAccumulator<M>, state: U, ) -> Result<Self, RecorderError>
Capture with asynchronous gradient readback; no recorder I/O is performed.
Sourcepub fn save<R: Recorder<B>>(
self,
recorder: &R,
args: R::RecordArgs,
) -> Result<R::RecordOutput, RecorderError>
pub fn save<R: Recorder<B>>( self, recorder: &R, args: R::RecordArgs, ) -> Result<R::RecordOutput, RecorderError>
Save all components in one recorder payload.
Sourcepub fn load<R: Recorder<B>>(
recorder: &R,
args: R::LoadArgs,
device: &B::Device,
) -> Result<Self, RecorderError>
pub fn load<R: Recorder<B>>( recorder: &R, args: R::LoadArgs, device: &B::Device, ) -> Result<Self, RecorderError>
Read a combined record using the selected recorder and device.
Sourcepub fn restore(
self,
model: M,
optimizer: O,
scheduler: S,
device: &B::Device,
) -> Result<RestoredTraining<M, O, S, U>, RecorderError>
pub fn restore( self, model: M, optimizer: O, scheduler: S, device: &B::Device, ) -> Result<RestoredTraining<M, O, S, U>, RecorderError>
Restore onto compatible model, optimizer and scheduler configurations.
No scheduler step, optimizer step or gradient reset is performed. Apply the returned caller state before consuming the next training batch.