Skip to main content

OuterAvg

Struct OuterAvg 

Source
pub struct OuterAvg;
Expand description

Identity outer optimizer: new_global = consensus. Stateless, no momentum, no checkpoint artifact. This is the default and reproduces the pre-outer-optimizer averaging behavior exactly.

Trait Implementations§

Source§

impl Clone for OuterAvg

Source§

fn clone(&self) -> OuterAvg

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 Copy for OuterAvg

Source§

impl Debug for OuterAvg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OuterAvg

Source§

fn default() -> OuterAvg

Returns the “default value” for a type. Read more
Source§

impl OuterOptimizer for OuterAvg

Source§

fn outer_step( &mut self, _prev_global: &[Tensor], consensus: &[Tensor], ) -> Result<Vec<Tensor>>

Transform consensus (this window’s work-weighted average) into the new global parameters, given prev_global (the global adopted at the end of the previous window). Momentum is updated internally. Read more
Source§

fn checkpoint_state(&self) -> Option<Vec<Tensor>>

Snapshot the checkpointable outer state (the slow momentum), one tensor per model parameter in Module::parameters() order, for <stem>.outer.fdl. None for stateless variants (OuterAvg), which write no artifact. Returns clones (shallow); the caller serializes them synchronously, so the live state may be overwritten by the next window without racing the detached write.
Source§

fn load_checkpoint_state(&mut self, _state: Vec<Tensor>) -> Result<()>

Restore outer state from <stem>.outer.fdl on resume. state is positional, one tensor per parameter (Module::parameters() order). Stateless variants ignore it.
Source§

fn resets_inner(&self) -> bool

Whether this variant requires disposable inner optimizer state: the worker, each sync, fully overwrites its params with the new global and resets its inner optimizer (clears momentum, step count). This is DiLoCo’s contract — the inner optimizer is restarted every outer round, which is what makes the outer momentum the canonical, resume-faithful state. false (default) keeps the inner loop continuous (OuterAvg, SlowMomentum). Read more

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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.