pub struct DistributedExpertManager { /* private fields */ }Expand description
Distributed expert execution manager
Implementations§
Source§impl DistributedExpertManager
impl DistributedExpertManager
pub fn new( config: ExpertParallelismConfig, process_group: Arc<ProcessGroup>, expert_params: &ExpertParameters, ) -> TorshResult<Self>
pub fn create_expert_sharding_map( config: &ExpertParallelismConfig, world_size: usize, rank: usize, ) -> HashMap<usize, ExpertShardInfo>
Sourcepub async fn execute_experts(
&mut self,
tokens: &Tensor<f32>,
routing_decision: &RoutingDecision,
) -> TorshResult<Tensor<f32>>
pub async fn execute_experts( &mut self, tokens: &Tensor<f32>, routing_decision: &RoutingDecision, ) -> TorshResult<Tensor<f32>>
Execute distributed expert computation
Sourcepub async fn aggregate_expert_gradients(
&mut self,
expert_gradients: &HashMap<usize, Tensor<f32>>,
) -> TorshResult<()>
pub async fn aggregate_expert_gradients( &mut self, expert_gradients: &HashMap<usize, Tensor<f32>>, ) -> TorshResult<()>
Aggregate gradients across distributed experts
Sourcepub fn get_expert_sharding_map(&self) -> &HashMap<usize, ExpertShardInfo>
pub fn get_expert_sharding_map(&self) -> &HashMap<usize, ExpertShardInfo>
Get expert sharding information
Sourcepub fn get_local_experts(&self) -> &Vec<Expert>
pub fn get_local_experts(&self) -> &Vec<Expert>
Get local experts
Sourcepub fn get_config(&self) -> &ExpertParallelismConfig
pub fn get_config(&self) -> &ExpertParallelismConfig
Get configuration
Sourcepub fn get_num_experts(&self) -> usize
pub fn get_num_experts(&self) -> usize
Get the total number of experts across all ranks
Auto Trait Implementations§
impl Freeze for DistributedExpertManager
impl !RefUnwindSafe for DistributedExpertManager
impl Send for DistributedExpertManager
impl Sync for DistributedExpertManager
impl Unpin for DistributedExpertManager
impl UnsafeUnpin for DistributedExpertManager
impl !UnwindSafe for DistributedExpertManager
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