pub struct DistributedTrainer { /* private fields */ }Expand description
Distributed trainer for multi-GPU/multi-node training
Implementations§
Source§impl DistributedTrainer
impl DistributedTrainer
pub fn new( config: TrainingConfig, distributed_config: DistributedConfig, ) -> Self
pub fn with_optimizer(self, optimizer: OptimizerType) -> Self
pub fn with_scheduler(self, scheduler: LearningRateScheduler) -> Self
Sourcepub async fn train_distributed(
&mut self,
model: Arc<RwLock<dyn EmbeddingModel + Send + Sync>>,
) -> Result<TrainingStats>
pub async fn train_distributed( &mut self, model: Arc<RwLock<dyn EmbeddingModel + Send + Sync>>, ) -> Result<TrainingStats>
Run the multi-worker training loop over a shared model.
Execution model (read before relying on this for scaling): every worker
operates on the same Arc<RwLock<dyn EmbeddingModel>> and replicates
the training loop, while the coordinator performs a real synchronous
all-reduce (sum-then-average across world_size ranks) of the per-rank
loss statistics exchanged each sync round and broadcasts the averaged
result back. Because the model is shared rather than sharded, this is a
training-loop-replication + loss-all-reduce harness, not full
parameter-level data-parallel SGD (no per-rank parameter gradients are
exchanged — there is a single shared parameter set). The all-reduce path
itself is genuinely executed, not simulated.
Auto Trait Implementations§
impl !RefUnwindSafe for DistributedTrainer
impl !UnwindSafe for DistributedTrainer
impl Freeze for DistributedTrainer
impl Send for DistributedTrainer
impl Sync for DistributedTrainer
impl Unpin for DistributedTrainer
impl UnsafeUnpin for DistributedTrainer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.