PrecisionSchedule

Struct PrecisionSchedule 

Source
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

Source

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 gate
  • lm_head_dtype: dtype for the final unembedding
  • sensitive_block_dtype + sensitive_block_indices: the “extra precision” tier for the first/last few blocks
  • default_dtype: bulk fallback (typically Inherit)

For now, the simpler [precision] schema only exposes these four; per-tensor / per-layer YAML can extend later.

Source

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:

  1. Sensitive-layer override (only for Attention/Expert)
  2. Per-role default
  3. Global default
Source

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

Source§

fn clone(&self) -> PrecisionSchedule

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PrecisionSchedule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PrecisionSchedule

Source§

fn default() -> Self

Empty schedule — every lookup returns Inherit. Bit-exact equivalent to the pre-C.3 behaviour. MODEL.toml omits the [precision] block to opt into this default.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more