pub struct TransformerOptimizerState<T: Float + Debug + Send + Sync + 'static> {
pub current_parameters: Array1<T>,
/* private fields */
}
Expand description
Transformer optimizer state
Fields§
§current_parameters: Array1<T>
Current model parameters
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static> TransformerOptimizerState<T>
impl<T: Float + Debug + Send + Sync + 'static> TransformerOptimizerState<T>
Sourcepub fn new(config: &TransformerBasedOptimizerConfig<T>) -> Result<Self>
pub fn new(config: &TransformerBasedOptimizerConfig<T>) -> Result<Self>
Create new optimizer state
Sourcepub fn update_with_step(
&mut self,
update: &Array1<T>,
loss: Option<T>,
) -> Result<()>
pub fn update_with_step( &mut self, update: &Array1<T>, loss: Option<T>, ) -> Result<()>
Update state with optimization step
Sourcepub fn create_snapshot(&self) -> Result<OptimizerStateSnapshot<T>>
pub fn create_snapshot(&self) -> Result<OptimizerStateSnapshot<T>>
Create state snapshot
Sourcepub fn restore_from_snapshot(
&mut self,
snapshot: &OptimizerStateSnapshot<T>,
) -> Result<()>
pub fn restore_from_snapshot( &mut self, snapshot: &OptimizerStateSnapshot<T>, ) -> Result<()>
Restore from snapshot
Sourcepub fn save_checkpoint(&mut self, name: String) -> Result<String>
pub fn save_checkpoint(&mut self, name: String) -> Result<String>
Save checkpoint
Sourcepub fn load_checkpoint(&mut self, checkpoint_id: &str) -> Result<()>
pub fn load_checkpoint(&mut self, checkpoint_id: &str) -> Result<()>
Load checkpoint
Sourcepub fn get_parameter_stats(&self) -> ParameterStatistics<T>
pub fn get_parameter_stats(&self) -> ParameterStatistics<T>
Get parameter statistics
Sourcepub fn get_optimization_progress(&self) -> OptimizationProgress<T>
pub fn get_optimization_progress(&self) -> OptimizationProgress<T>
Get optimization progress
Sourcepub fn get_learning_stats(&self) -> LearningStatistics<T>
pub fn get_learning_stats(&self) -> LearningStatistics<T>
Get learning statistics
Sourcepub fn validate_state(&self) -> Result<StateValidationReport>
pub fn validate_state(&self) -> Result<StateValidationReport>
Validate state consistency
Sourcepub fn get_state_summary(&self) -> StateSummary<T>
pub fn get_state_summary(&self) -> StateSummary<T>
Get state summary
Sourcepub fn get_metadata(&self) -> StateMetadata
pub fn get_metadata(&self) -> StateMetadata
Get state metadata
Sourcepub fn export_state(&self) -> Result<SerializableState<T>>
pub fn export_state(&self) -> Result<SerializableState<T>>
Export state to serializable format
Sourcepub fn import_state(&mut self, state: SerializableState<T>) -> Result<()>
pub fn import_state(&mut self, state: SerializableState<T>) -> Result<()>
Import state from serializable format
Auto Trait Implementations§
impl<T> Freeze for TransformerOptimizerState<T>where
T: Freeze,
impl<T> RefUnwindSafe for TransformerOptimizerState<T>where
T: RefUnwindSafe,
impl<T> Send for TransformerOptimizerState<T>
impl<T> Sync for TransformerOptimizerState<T>
impl<T> Unpin for TransformerOptimizerState<T>where
T: Unpin,
impl<T> UnwindSafe for TransformerOptimizerState<T>where
T: UnwindSafe + RefUnwindSafe,
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.