pub struct ExpertRecordHeader {
pub layer: u32,
pub expert: u32,
pub inter: u32,
pub hidden: u32,
pub group_size: u32,
pub scale2: [f32; 3],
pub input_scale: [Option<f32>; 3],
}Expand description
2026-09-25: The fixed, versioned header at the front of every expert
record. It carries what the dims do not give, each projection’s
weight_scale_2 and input_scale, plus layer, expert and shape so a
mismatched file can be recognised.
Fields§
§layer: u32§expert: u32§inter: u32§group_size: u32§scale2: [f32; 3]2026-09-25: weight_scale_2 of gate, up, down.
input_scale: [Option<f32>; 3]2026-09-25: input_scale of gate, up, down; None when the
projection has none. Presence is a bit in the header’s
input_scale_flags word, so PartialEq needs no NaN sentinel.
Implementations§
Source§impl ExpertRecordHeader
impl ExpertRecordHeader
pub const MAGIC: u32 = 0x5850_5254
pub const VERSION: u32 = 1
Sourcepub const BYTES: u64 = 256
pub const BYTES: u64 = 256
2026-09-25: Reserved header size; the fields use the first 56 bytes, so the header can grow without moving the sub-buffers.
Sourcepub fn to_bytes(&self) -> [u8; 256]
pub fn to_bytes(&self) -> [u8; 256]
2026-09-25: Serialize into the fixed 256-byte header block,
little-endian:
u32 magic, u32 version, u32 layer, u32 expert,
u32 inter, u32 hidden, u32 group_size, u32 input_scale_flags,
f32 scale2[3], f32 input_scale[3] (0.0 where absent), zero pad to 256.
input_scale_flags bit i set => projection i has an activation scale.
Sourcepub fn from_bytes(buf: &[u8]) -> Option<Self>
pub fn from_bytes(buf: &[u8]) -> Option<Self>
2026-09-25: Parse a header block. None when it is shorter than
BYTES or the magic or version differs.
Trait Implementations§
Source§impl Clone for ExpertRecordHeader
impl Clone for ExpertRecordHeader
Source§fn clone(&self) -> ExpertRecordHeader
fn clone(&self) -> ExpertRecordHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more