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
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.
Implementations§
Source§impl LayerLoops
impl LayerLoops
Sourcepub fn logical_layers(&self) -> usize
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.
Sourcepub fn physical_layers(&self) -> usize
pub fn physical_layers(&self) -> usize
Physical layers: how many blocks the file holds tensors for.
Sourcepub fn loop_norm_after(&self, l: usize) -> Option<LoopNorm>
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.
Sourcepub fn stack_starts_at(&self, l: usize) -> bool
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?
Sourcepub fn stream_after(&self, l: usize) -> Option<HrmStream>
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
impl Clone for LayerLoops
impl Copy for LayerLoops
Source§impl Debug for LayerLoops
impl Debug for LayerLoops
impl Eq for LayerLoops
Source§impl PartialEq for LayerLoops
impl PartialEq for LayerLoops
impl StructuralPartialEq for LayerLoops
Auto Trait Implementations§
impl Freeze for LayerLoops
impl RefUnwindSafe for LayerLoops
impl Send for LayerLoops
impl Sync for LayerLoops
impl Unpin for LayerLoops
impl UnsafeUnpin for LayerLoops
impl UnwindSafe for LayerLoops
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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