Skip to main content

V2Config

Struct V2Config 

Source
pub struct V2Config {
    pub vocab_size: usize,
    pub d_model: usize,
    pub num_heads: usize,
    pub num_kv_heads: usize,
    pub num_layers: usize,
    pub head_dim: usize,
    pub max_seq_len: usize,
    pub hada_n: usize,
    pub mhc_lanes: usize,
    pub rope_theta: f32,
    pub kv_window: usize,
    pub engram: EngramGeometry,
}
Expand description

Full v2 model geometry.

Fields§

§vocab_size: usize§d_model: usize§num_heads: usize§num_kv_heads: usize§num_layers: usize§head_dim: usize§max_seq_len: usize§hada_n: usize

Hadamard width in HadamardMLP: d_model rounded up to a power of two.

§mhc_lanes: usize§rope_theta: f32§kv_window: usize

Sliding attention window. 0 disables it (full causal).

§engram: EngramGeometry

Implementations§

Source§

impl V2Config

Source

pub fn attn_dim(&self) -> usize

Attention width, num_heads * head_dim.

Source

pub fn kv_dim(&self) -> usize

Packed K/V projection width.

Source

pub fn kv_repeat(&self) -> usize

Query heads served by one KV head.

Source

pub fn mhc_width(&self) -> usize

Flattened mHC lane-stream width, mhc_lanes * d_model.

Source

pub fn active_lane(&self, layer: usize) -> usize

The lane layer i is “assigned” to — eye(n)[i % n] in architecture.Stack, which drives the pre_off / post_off biases.

Source

pub fn pre_off(&self, layer: usize, lane: usize) -> f32

pre_off[layer][lane] — 8 * lane_onehot - 4.

Source

pub fn post_off(&self, layer: usize, lane: usize) -> f32

post_off[layer][lane] — -4 * (1 - lane_onehot).

Source

pub fn validate(&self) -> Result<(), &'static str>

Trait Implementations§

Source§

impl Clone for V2Config

Source§

fn clone(&self) -> V2Config

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 Debug for V2Config

Source§

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

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

impl PartialEq for V2Config

Source§

fn eq(&self, other: &V2Config) -> 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 V2Config

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> 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.