pub struct SwaPattern {
pub period: usize,
pub dense_first: bool,
}Expand description
llama.cpp’s hardcoded alternating sliding-window layout for one architecture: the period, and which end of each period is the full-attention layer.
llama_hparams::set_swa_pattern (src/llama-hparams.cpp:8-22) has
two phases, and they are not interchangeable:
dense_first = false:is_swa[il] = il % p < (p - 1)— the last layer of every period is full attention.dense_first = true:is_swa[il] = il % p != 0— the first layer of every period is full attention.
For a 32-layer period-4 model the two disagree on 16 of the 32
layers. Storing only the period would therefore not be a partial
transcription, it would be a wrong one for the four architectures
llama.cpp passes dense_first = true.
Fields§
§period: usizellama.cpp’s swa_period seed literal.
dense_first: boolllama.cpp’s dense_first argument to set_swa_pattern.
Trait Implementations§
Source§impl Clone for SwaPattern
impl Clone for SwaPattern
Source§fn clone(&self) -> SwaPattern
fn clone(&self) -> SwaPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SwaPattern
Source§impl Debug for SwaPattern
impl Debug for SwaPattern
impl Eq for SwaPattern
Source§impl PartialEq for SwaPattern
impl PartialEq for SwaPattern
impl StructuralPartialEq for SwaPattern
Auto Trait Implementations§
impl Freeze for SwaPattern
impl RefUnwindSafe for SwaPattern
impl Send for SwaPattern
impl Sync for SwaPattern
impl Unpin for SwaPattern
impl UnsafeUnpin for SwaPattern
impl UnwindSafe for SwaPattern
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
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> ⓘ
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 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> ⓘ
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