pub struct PrecisionSchedule { /* private fields */ }Expand description
Per-(layer, role) precision schedule built from MODEL.toml’s
[precision] block. Lookups are O(1) for the common tables;
per-layer overrides hit a small sorted set.
Implementations§
Source§impl PrecisionSchedule
impl PrecisionSchedule
Sourcepub fn build(
router_dtype: Dtype,
lm_head_dtype: Dtype,
sensitive_block_indices: &[u16],
sensitive_block_dtype: Dtype,
default_dtype: Dtype,
) -> Self
pub fn build( router_dtype: Dtype, lm_head_dtype: Dtype, sensitive_block_indices: &[u16], sensitive_block_dtype: Dtype, default_dtype: Dtype, ) -> Self
Build from the four documented MODEL.toml fields:
router_dtype: dtype for the MoE gatelm_head_dtype: dtype for the final unembeddingsensitive_block_dtype+sensitive_block_indices: the “extra precision” tier for the first/last few blocksdefault_dtype: bulk fallback (typically Inherit)
For now, the simpler [precision] schema only exposes these
four; per-tensor / per-layer YAML can extend later.
Sourcepub fn dtype_for(&self, layer_idx: Option<u16>, role: Role) -> Dtype
pub fn dtype_for(&self, layer_idx: Option<u16>, role: Role) -> Dtype
Resolve the target dtype for a tensor. layer_idx = None is
used for non-layer tensors (embedding, lm_head, final norm).
Lookup order:
- Sensitive-layer override (only for Attention/Expert)
- Per-role default
- Global default
Sourcepub fn has_any_override(&self) -> bool
pub fn has_any_override(&self) -> bool
True iff the schedule will produce any non-Inherit overrides. Loaders can use this to skip the per-tensor lookups entirely when no overrides are configured (default case).
Trait Implementations§
Source§impl Clone for PrecisionSchedule
impl Clone for PrecisionSchedule
Source§fn clone(&self) -> PrecisionSchedule
fn clone(&self) -> PrecisionSchedule
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 Debug for PrecisionSchedule
impl Debug for PrecisionSchedule
Auto Trait Implementations§
impl Freeze for PrecisionSchedule
impl RefUnwindSafe for PrecisionSchedule
impl Send for PrecisionSchedule
impl Sync for PrecisionSchedule
impl Unpin for PrecisionSchedule
impl UnwindSafe for PrecisionSchedule
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