pub struct ExpertSliceMap { /* private fields */ }Expand description
The stacked expert tensors of every MoE layer, located once.
Implementations§
Source§impl ExpertSliceMap
impl ExpertSliceMap
pub fn new(files: Arc<ShardFiles>) -> Result<Self>
Sourcepub fn layers(&self) -> &[ExpertLayerLoc]
pub fn layers(&self) -> &[ExpertLayerLoc]
MoE layers in ascending order.
pub fn layer(&self, layer: usize) -> Option<&ExpertLayerLoc>
pub fn files(&self) -> &Arc<ShardFiles>
Trait Implementations§
Source§impl ExpertSource for ExpertSliceMap
impl ExpertSource for ExpertSliceMap
fn slot_layout(&self) -> SlotLayout
fn num_experts(&self) -> usize
Source§fn read_expert(&self, layer: u32, expert: u32, dst: &mut [u8]) -> Result<()>
fn read_expert(&self, layer: u32, expert: u32, dst: &mut [u8]) -> Result<()>
Fill
dst (exactly slot_layout().bytes long) with expert expert of
layer layer, in slot layout.Source§fn read_expert_range(
&self,
layer: u32,
expert: u32,
off: usize,
dst: &mut [u8],
) -> Result<()>
fn read_expert_range( &self, layer: u32, expert: u32, off: usize, dst: &mut [u8], ) -> Result<()>
Fill
dst with bytes off..off + dst.len() of the expert’s slot
image, so one miss can be read by several threads at once. The
default reads the whole expert into scratch; the on-disk map seeks.Auto Trait Implementations§
impl Freeze for ExpertSliceMap
impl RefUnwindSafe for ExpertSliceMap
impl Send for ExpertSliceMap
impl Sync for ExpertSliceMap
impl Unpin for ExpertSliceMap
impl UnwindSafe for ExpertSliceMap
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