Skip to main content

MuonAdamW

Struct MuonAdamW 

Source
pub struct MuonAdamW<M: AutodiffModule<B>, B: AutodiffBackend> { /* private fields */ }
Expand description

Mixed optimizer with fixed, explicit parameter identities. Missing gradients skip both momentum and decay for that parameter. A tied parameter is updated once, by its ParamId.

Implementations§

Source§

impl<M: AutodiffModule<B>, B: AutodiffBackend> MuonAdamW<M, B>

Source

pub fn muon_parameter_count(&self) -> usize

Number of distinct parameters routed to Muon, not number of matrix elements.

Source

pub fn try_step_with_lrs( &mut self, muon_lr: LearningRate, adamw_lr: LearningRate, module: M, grads: GradientsParams, ) -> Result<M, MuonError>

Update with independent learning rates. Metadata for both groups is checked before either group submits an update. Device runtime errors are still asynchronous and this method is NOT a two-phase device transaction.

Source

pub fn try_step_or_skip( &mut self, muon_lr: LearningRate, adamw_lr: LearningRate, module: M, grads: GradientsParams, skip_update: bool, ) -> Result<M, MuonError>

An explicit all-group skip makes no optimizer update and changes no state. The caller must decide skip consistently across all replicas and must unscale/check finite gradients before a non-skipped update.

Source

pub fn try_load_record( self, record: MuonAdamWRecord<B>, ) -> Result<Self, MuonError>

Restore only compatible grouping/configuration. Does not silently move a momentum buffer between SGD and EMA conventions or between parameter roles.

Trait Implementations§

Source§

impl<M: Clone + AutodiffModule<B>, B: Clone + AutodiffBackend> Clone for MuonAdamW<M, B>
where B::InnerBackend: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: AutodiffModule<B>, B: AutodiffBackend> Optimizer<M, B> for MuonAdamW<M, B>

Source§

type Record = MuonAdamWRecord<B>

Optimizer associative type to be used when saving and loading the state.
Source§

fn step(&mut self, lr: LearningRate, module: M, grads: GradientsParams) -> M

Perform the optimizer step using the given learning rate and gradients. The updated module is returned.
Source§

fn step_multi( &mut self, _lr: LearningRate, _module: M, _grads: MultiGradientsParams, ) -> M

Perform the optimizer step using the given learning rate and gradients. The updated module is returned.
Source§

fn to_record(&self) -> Self::Record

Get the current state of the optimizer as a record.
Source§

fn load_record(self, record: Self::Record) -> Self

Load the state of the optimizer as a record.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.