pub struct Qwen35ForwardConfig {Show 16 fields
pub hidden: u32,
pub intermediate: u32,
pub num_layers: u32,
pub vocab: u32,
pub group_size: u32,
pub rms_eps: f32,
pub num_heads: u32,
pub num_kv_heads: u32,
pub head_dim: u32,
pub rope_theta: f32,
pub rotary_dim: u32,
pub num_k_heads_lin: u32,
pub num_v_heads_lin: u32,
pub k_head_dim_lin: u32,
pub v_head_dim_lin: u32,
pub conv_kernel_size: u32,
}Expand description
Compile-time-fixed dimensions for a Qwen3.5 checkpoint. Populate
from the model’s config.json (text_config) at startup.
Fields§
§intermediate: u32§num_layers: u32§vocab: u32§group_size: u32§rms_eps: f32§num_heads: u32§num_kv_heads: u32§head_dim: u32§rope_theta: f32§rotary_dim: u32head_dim * partial_rotary_factor — Qwen3.5-VL rotates only
the first rotary_dim of each head (=64 of 256 for the
4B checkpoint with partial_rotary_factor = 0.25).
num_k_heads_lin: u32§num_v_heads_lin: u32§k_head_dim_lin: u32§v_head_dim_lin: u32§conv_kernel_size: u32Implementations§
Source§impl Qwen35ForwardConfig
impl Qwen35ForwardConfig
Sourcepub const fn qwen3_5_4b_mlx_int8() -> Self
pub const fn qwen3_5_4b_mlx_int8() -> Self
Hardcoded constants for mlx-community/Qwen3.5-4B-MLX-8bit.
Matches the Metal example’s dims.rs exactly so the extracted
forward path is byte-equivalent to the inlined version.
Sourcepub const fn q_total(&self) -> u32
pub const fn q_total(&self) -> u32
Q_TOTAL = num_heads * head_dim * 2 — Qwen3.5 packs the
attention output gate into the same projection as Q, so the
q_proj produces a [num_heads, head_dim * 2] interleaved
tensor that needs a deinterleave step before normalisation.
Sourcepub const fn q_only(&self) -> u32
pub const fn q_only(&self) -> u32
Q_ONLY = num_heads * head_dim — half of Q_TOTAL, the
post-deinterleave Q size.
Sourcepub const fn qkv_total_lin(&self) -> u32
pub const fn qkv_total_lin(&self) -> u32
QKV_TOTAL_LIN = (num_k_heads_lin + num_k_heads_lin) * k_head_dim_lin + num_v_heads_lin * v_head_dim_lin.
Sourcepub const fn num_state_heads(&self) -> u32
pub const fn num_state_heads(&self) -> u32
NUM_STATE_HEADS = num_v_heads_lin — the number of GDN heads
the gate / beta / dt_bias / A_log vectors all run over.
Trait Implementations§
Source§impl Clone for Qwen35ForwardConfig
impl Clone for Qwen35ForwardConfig
Source§fn clone(&self) -> Qwen35ForwardConfig
fn clone(&self) -> Qwen35ForwardConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more