Skip to main content

LayerLoops

Enum LayerLoops 

Source
pub enum LayerLoops {
    Repeat {
        n_phys: usize,
        n_loops: usize,
        skip_loop_final_norm: bool,
    },
    Hrm {
        lps: usize,
        h_cycles: usize,
        l_cycles: usize,
    },
}
Expand description

A model whose logical layers are several passes over fewer physical ones.

Two shapes, because two graphs upstream do it and they differ in every detail but that: which physical layer a pass runs, what norm sits at a pass boundary, and whether the passes share ONE residual stream (nanbeige) or recombine TWO (hrm_text). Parameterising one enum rather than adding a second field for each difference is what keeps the three host bodies asking one question.

Variants§

§

Repeat

nanbeige.cpp:6-31: n_loops passes over n_phys layers, one residual stream, output_norm between passes.

Fields

§n_phys: usize

Physical layers: the blocks the file holds tensors for.

§n_loops: usize

Passes over them; >= 2.

§skip_loop_final_norm: bool

{arch}.skip_loop_final_norm: no norm between passes.

§

Hrm

hrm-text.cpp:47-87,183-196: TWO stacks of lps layers each – the file holds 2 * lps blocks – replayed over h_cycles * (l_cycles + 1) passes, with a weightless norm after every pass and the two residual streams recombined at every stack boundary.

Fields

§lps: usize

{arch}.hrm.layers_per_stack.

§h_cycles: usize

{arch}.hrm.h_cycles.

§l_cycles: usize

{arch}.hrm.l_cycles.

Implementations§

Source§

impl LayerLoops

Source

pub fn logical_layers(&self) -> usize

llama.cpp’s n_layer_all, the count every per-layer thing – the KV caches above all – is sized by.

Source

pub fn physical(&self, l: usize) -> usize

The physical layer logical layer l runs.

Source

pub fn physical_layers(&self) -> usize

Physical layers: how many blocks the file holds tensors for.

Source

pub fn loop_norm_after(&self, l: usize) -> Option<LoopNorm>

The norm applied to the residual AFTER logical layer l, if any.

nanbeige norms at the end of every pass but the LAST (its own output_norm follows that one anyway) and only when the file does not skip it; hrm_text norms at the end of EVERY stack, including the last, because it has no other final norm.

Source

pub fn stack_starts_at(&self, l: usize) -> bool

Does logical layer l START a stack, i.e. does the residual it reads come from recombining the two streams?

Source

pub fn stream_after(&self, l: usize) -> Option<HrmStream>

Which stream the pass ending at logical layer l writes, or None when l does not end a stack.

Trait Implementations§

Source§

impl Clone for LayerLoops

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for LayerLoops

Source§

impl Debug for LayerLoops

Source§

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

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

impl Eq for LayerLoops

Source§

impl PartialEq for LayerLoops

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LayerLoops

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.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.