pub struct ExpertLoraLayer {
pub pairs: BTreeMap<(u16, ExpertProj), LoraPair>,
}Expand description
One MoE layer’s routed-expert LoRA coverage: a SPARSE map keyed by
(expert_index, projection). Real adapters adapt a subset of the (up to 512)
experts, so a dense Vec<[LoraPair; 3]> sized num_experts would waste
storage and force a 512-wide static walk; the map only holds the packed pairs.
LoraPair is Copy, so the whole struct is cheap to Clone on install.
Fields§
§pairs: BTreeMap<(u16, ExpertProj), LoraPair>Implementations§
Source§impl ExpertLoraLayer
impl ExpertLoraLayer
Sourcepub fn pair(&self, expert: u16, proj: ExpertProj) -> Option<&LoraPair>
pub fn pair(&self, expert: u16, proj: ExpertProj) -> Option<&LoraPair>
This layer’s (expert, proj) pair, if adapted.
Sourcepub fn adapted_experts(&self) -> Vec<u16>
pub fn adapted_experts(&self) -> Vec<u16>
Sorted, deduped list of the expert indices this layer adapts — the SSOT for “which experts get a delta applied” in the forward side-path.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for ExpertLoraLayer
impl Clone for ExpertLoraLayer
Source§fn clone(&self) -> ExpertLoraLayer
fn clone(&self) -> ExpertLoraLayer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ExpertLoraLayer
impl Default for ExpertLoraLayer
Source§fn default() -> ExpertLoraLayer
fn default() -> ExpertLoraLayer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ExpertLoraLayer
impl RefUnwindSafe for ExpertLoraLayer
impl Send for ExpertLoraLayer
impl Sync for ExpertLoraLayer
impl Unpin for ExpertLoraLayer
impl UnwindSafe for ExpertLoraLayer
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