pub struct TpMoeDims {
pub tp_rank: usize,
pub tp_size: usize,
pub h: usize,
pub full_inter: usize,
pub local_inter: usize,
}Expand description
Pre-TP-shard dimensions for MoE expert projections. Unlike attention,
main.rs does NOT divide moe_intermediate_size by tp_size, so
full_inter == config.moe_intermediate_size. Local size is computed
here for downstream callers.
Fields§
§tp_rank: usize§tp_size: usize§h: usize§full_inter: usizeFull MoE intermediate dim (NOT yet TP-divided).
local_inter: usizeLocal (post-shard) MoE intermediate dim.
Implementations§
Source§impl TpMoeDims
impl TpMoeDims
pub fn from_config(config: &ModelConfig) -> Self
Sourcepub fn proj_shape(&self, name: &str) -> Option<(usize, usize, TpShardKind)>
pub fn proj_shape(&self, name: &str) -> Option<(usize, usize, TpShardKind)>
(out_dim, in_dim, kind) for one of gate_proj / up_proj /
down_proj. Gate/up are column-parallel on inter; down is
row-parallel on inter (so [h, inter] rows truncate to [h, inter/tp]).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TpMoeDims
impl RefUnwindSafe for TpMoeDims
impl Send for TpMoeDims
impl Sync for TpMoeDims
impl Unpin for TpMoeDims
impl UnwindSafe for TpMoeDims
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