oa::ml::Training
Exact eager or captured training-step lifecycle. The loop borrows the runtime, optimizer, metrics, and callbacks. Call Training::begin_step before authoring each body, then finish it with Training::complete_step or Training::complete_program_step. Training::finish is the explicit fallible terminal boundary.
Declaration
pub struct Training<'runtime, 'hooks> { /* private fields */ }Public Rust declaration.
Public Methods
pub fn fit( self, model: &dyn Module, loader: &mut DataLoader<'_>, epochs: u64, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, ) -> Result<TrainingHistory>pub fn fit_with_options( self, model: &dyn Module, loader: &mut DataLoader<'_>, epochs: u64, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, options: TrainingFitOptions<'_, '_>, ) -> Result<TrainingHistory>pub fn fit_supervised_batches( self, epochs: u64, batches_per_epoch: u64, batch_at: impl FnMut(u64, u64) -> Result<Batch>, forward: impl FnMut(&Matrix) -> Result<Matrix>, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, options: TrainingFitOptions<'_, '_>, ) -> Result<TrainingHistory>pub fn fit_with( self, epochs: u64, batches_per_epoch: u64, batch_at: impl FnMut(u64, u64) -> Result<Batch>, step: impl FnMut(&Batch) -> Result<Matrix>, ) -> Result<TrainingHistory>pub fn attach_session( &mut self, session: &TrainingSession, handlers: TrainingSessionHandlers<'hooks>, ) -> Result<()>pub fn complete_step_scaled( &mut self, loss: &Matrix, check: &Matrix, scaler: &mut GradScaler, ) -> Result<bool>Associated Functions
pub fn evaluate( model: &dyn Module, loader: &mut DataLoader<'_>, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, ) -> Result<ValidationResult>pub fn evaluate_supervised( model: &dyn Module, loader: &mut DataLoader<'_>, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, categorical_accuracy: bool, ) -> Result<EvaluationReport>pub fn evaluate_prediction_batches( loader: &mut DataLoader<'_>, forward: impl FnMut(&Matrix) -> Result<Matrix>, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, categorical_accuracy: bool, ) -> Result<EvaluationReport>pub fn evaluate_predictions( batches: impl IntoIterator<Item = Result<Batch>>, forward: impl FnMut(&Matrix) -> Result<Matrix>, loss: impl FnMut(&Matrix, &Matrix) -> Result<Matrix>, categorical_accuracy: bool, ) -> Result<EvaluationReport>pub fn evaluate_with( batches: impl IntoIterator<Item = Result<Batch>>, step: impl FnMut(&Batch) -> Result<Matrix>, ) -> Result<ValidationResult>pub fn new( runtime: &'runtime Runtime, optimizer: &'runtime mut AdamW, config: TrainingConfig, ) -> Result<Self>Public Method Documentation
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
No public source comment is attached to this declaration.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.