pub struct Prodigy { /* private fields */ }Expand description
Prodigy optimizer with adaptive learning rate estimation.
Implementations§
Source§impl Prodigy
impl Prodigy
Sourcepub fn with_config(config: ProdigyConfig) -> Self
pub fn with_config(config: ProdigyConfig) -> Self
Create Prodigy optimizer with custom configuration.
Sourcepub fn for_language_models() -> Self
pub fn for_language_models() -> Self
Create Prodigy optimizer optimized for language models.
Sourcepub fn for_vision() -> Self
pub fn for_vision() -> Self
Create Prodigy optimizer optimized for computer vision.
Sourcepub fn for_fast_training() -> Self
pub fn for_fast_training() -> Self
Create Prodigy optimizer for fast training.
Sourcepub fn for_stable_training() -> Self
pub fn for_stable_training() -> Self
Create Prodigy optimizer for stable training.
Sourcepub fn set_lr(&mut self, distance: f64)
pub fn set_lr(&mut self, distance: f64)
Set global distance estimate (equivalent to learning rate).
Sourcepub fn memory_usage(&self) -> ProdigyMemoryStats
pub fn memory_usage(&self) -> ProdigyMemoryStats
Get memory usage statistics.
Trait Implementations§
Source§impl Optimizer for Prodigy
impl Optimizer for Prodigy
Source§fn update(&mut self, param: &mut Tensor, grad: &Tensor) -> Result<()>
fn update(&mut self, param: &mut Tensor, grad: &Tensor) -> Result<()>
Updates a parameter based on its gradient. Read more
Source§fn accumulate_grad(
&mut self,
parameter: &mut Tensor,
grad: &Tensor,
) -> Result<(), TrustformersError>
fn accumulate_grad( &mut self, parameter: &mut Tensor, grad: &Tensor, ) -> Result<(), TrustformersError>
Accumulates gradients for gradient accumulation. Read more
Source§fn apply_accumulated_grads(
&mut self,
accumulation_steps: usize,
) -> Result<(), TrustformersError>
fn apply_accumulated_grads( &mut self, accumulation_steps: usize, ) -> Result<(), TrustformersError>
Applies accumulated gradients after gradient accumulation. Read more
Source§impl StatefulOptimizer for Prodigy
impl StatefulOptimizer for Prodigy
Source§type Config = ProdigyConfig
type Config = ProdigyConfig
The configuration type for this optimizer.
Source§type State = ProdigyOptimizerState
type State = ProdigyOptimizerState
The state type used by this optimizer.
Source§fn state_mut(&mut self) -> &mut Self::State
fn state_mut(&mut self) -> &mut Self::State
Gets a mutable reference to the optimizer’s internal state.
Source§fn state_dict(&self) -> Result<HashMap<String, Tensor>>
fn state_dict(&self) -> Result<HashMap<String, Tensor>>
Saves the optimizer state to a dictionary for checkpointing.
Source§fn load_state_dict(&mut self, state_dict: HashMap<String, Tensor>) -> Result<()>
fn load_state_dict(&mut self, state_dict: HashMap<String, Tensor>) -> Result<()>
Loads optimizer state from a dictionary during checkpoint restoration.
Source§fn memory_usage(&self) -> StateMemoryStats
fn memory_usage(&self) -> StateMemoryStats
Gets memory usage statistics for this optimizer.
Source§fn reset_state(&mut self)
fn reset_state(&mut self)
Resets the optimizer state (useful for training restarts).
Source§fn num_parameters(&self) -> usize
fn num_parameters(&self) -> usize
Returns the number of parameters being optimized.
Auto Trait Implementations§
impl Freeze for Prodigy
impl RefUnwindSafe for Prodigy
impl Send for Prodigy
impl Sync for Prodigy
impl Unpin for Prodigy
impl UnwindSafe for Prodigy
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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