pub struct DataParallelTrainer<M: Model<Input = Tensor, Output = Tensor>> { /* private fields */ }Expand description
Data parallel trainer that wraps a model for distributed training
Implementations§
Source§impl<M: Model<Input = Tensor, Output = Tensor>> DataParallelTrainer<M>
impl<M: Model<Input = Tensor, Output = Tensor>> DataParallelTrainer<M>
pub fn new( model: M, process_group: Arc<dyn ProcessGroup>, config: DistributedConfig, ) -> Result<Self>
Sourcepub fn backward(&self, gradients: &mut HashMap<String, Tensor>) -> Result<()>
pub fn backward(&self, gradients: &mut HashMap<String, Tensor>) -> Result<()>
Backward pass with gradient synchronization
Sourcepub fn broadcast_parameters(&self) -> Result<()>
pub fn broadcast_parameters(&self) -> Result<()>
Broadcast model parameters from rank 0 to all other ranks
Sourcepub fn process_group(&self) -> Arc<dyn ProcessGroup>
pub fn process_group(&self) -> Arc<dyn ProcessGroup>
Get process group
Auto Trait Implementations§
impl<M> Freeze for DataParallelTrainer<M>
impl<M> !RefUnwindSafe for DataParallelTrainer<M>
impl<M> Send for DataParallelTrainer<M>
impl<M> Sync for DataParallelTrainer<M>
impl<M> Unpin for DataParallelTrainer<M>
impl<M> UnsafeUnpin for DataParallelTrainer<M>
impl<M> !UnwindSafe for DataParallelTrainer<M>
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